Under Ubuntu, you can manage hardware disk arrays by installing the LSI MegaRAID megacli command line tool. The specific installation steps are as follows.
1. Add MegaRAID Source:
Modify/etc/apt/sources.list to add at the end
Deb Http://hwraid.le-vert.net/ubuntu Precise Main
Then execute:
Apt-get Update
Apt-get Install MEGACLI megactl megaraid-status
If you are performing a GPG error, you need to add a certificate by executing the following command:
Wget-o-Http://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | sudo apt-key add-
Then execute again:
Apt-get Install MEGACLI megactl megaraid-status
At this point the basic can be installed successfully, here are some basic commands:
to view information about a virtual drive:
Megacli-ldinfo-lall-aall
To View Physical disk information:
Megacli-pdlist-aall
Write all events to the specified file:
Megacli-adpeventlog-getevents-f Logfile-aall
Related commands and their parsing:
View Machine Model # Dmidecode | grep "Product"
View Manufacturers # dmidecode| grep "Manufacturer"
View Serial # Dmidecode | grep "Serial number"
View CPU Information # Dmidecode | grep "CPU"
See number of CPUs # Dmidecode | grep "Socket designation:cpu" |wc–l
View Factory Date # Dmidecode | grep "Date"
View charge status # megacli-adpbbucmd-getbbustatus-aall |grep "Charger status"
Display BBU status information # Megacli-adpbbucmd-getbbustatus–aall
Display BBU Capacity Information # Megacli-adpbbucmd-getbbucapacityinfo–aall
Display BBU Design Parameters # Megacli-adpbbucmd-getbbudesigninfo–aall
Show current BBU Properties # Megacli-adpbbucmd-getbbuproperties–aall
View charge Progress% # Megacli-adpbbucmd-getbbustatus-aall |grep "Relative State of Charge"
Query RAID Array # Megacli-cfgdsply-aall |grep "number of DISK GROUPS:"
Display RAID card model, RAID settings, disk related information # Megacli-cfgdsply–aall
Show all physical Information # Megacli-pdlist-aall
Show all Logical Disk group information # Megacli-ldinfo-lall–aall
View Physical Disk rebuild Progress (important) # Megacli-pdrbld-showprog-physdrv [1:5]-a0
See the number of adapters #megacli –adpcount
View adapter Time #megacli-adpgettime–aall
Show all adapter Information #megacli-adpallinfo–aall
View cache policy Settings # Megacli-cfgdsply-aall |grep polic
Hard disk:
1. View all Physical Disk information
Megacli-pdlist-aall
Adapter #0
Enclosure Number:1
Slot Number:5
Device Id:5
Sequence Number:2
Media Error count:0
Other Error count:0
Predictive Failure count:0
Last predictive Failure Event Seq number:0
Raw SIZE:140014MB [0x11177328 sectors]
Non coerced SIZE:139502MB [0x11077328 sectors]
coerced SIZE:139392MB [0x11040000 sectors]
Firmware State:hotspare
SAS Address (0): 0x5000c50008e5cca9
SAS Address (1): 0x0
Inquiry data:seagate st3146855ss s5273ln4y1x0
.....
2. View the disk cache policy
Megacli-ldgetprop-cache-l0-a0
Adapter 0-vd 0:cache policy:writeback, Readaheadnone, Direct
Or
Megacli-ldgetprop-cache-l1-a0
Adapter 0-vd 1:cache policy:writeback, Readaheadnone, Direct
Or
Megacli-ldgetprop-cache-lall-a0
Adapter 0-vd 0:cache policy:writeback, Readaheadnone, Direct
Adapter 0-vd 1:cache policy:writeback, Readaheadnone, Direct
Or
Megacli-ldgetprop-cache-lall-aall
Adapter 0-vd 0:cache policy:writeback, Readaheadnone, Direct
Adapter 0-vd 1:cache policy:writeback, Readaheadnone, Direct
Or
Megacli-ldgetprop-dskcache-lall-aall
Adapter 0-vd 0:disk Write cache:disk ' s Default
Adapter 0-vd 1:disk Write cache:disk ' s Default
3. Set the disk cache policy
Caching Policy Explanation:
WT (Write through
WB (Write back)
NORA (No read ahead)
RA (Read ahead)
ADRA (Adaptive read ahead)
Cached
Direct
Example:
Megacli-ldsetprop wt| wb| nora| ra| Adra-l0-a0
Or
Megacli-ldsetprop-cached|-direct-l0-a0
Or
Enable/disable Disk Cache
Megacli-ldsetprop-endskcache|-disdskcache-l0-a0
4. Create/delete array
4.1 Create a RAID5 array, composed of physical disk 2,3,4, the hot spare of the array is the physical disk 5
MEGACLI-CFGLDADD-R5 [1:2,1:3,1:4] WB direct-hsp[1:5]–a0
4.2 Creating an array without specifying a hot spare
MEGACLI-CFGLDADD-R5 [1:2,1:3,1:4] WB direct–a0
4.3 Deleting an array
Megacli-cfglddel-l1–a0
4.4 Adding disks online
Megacli-ldrecon-start-r5-add-physdrv[1:4]-l1-a0
This means that the Rebuild Logical disk group 1,raid level is 5, adding the Physical disk number: 1:4. After the rebuild is complete, the newly added physical disk is automatically in the Rebuild (sync) state, and this time fdisk-l is not able to see the space of the array become larger, only after the system restarts.
5. View array Initialization information
5.1 Once the array is created, there is a process to initialize the synchronization block to see its progress.
Megacli-ldinit-showprog-lall-aall
or display it in a dynamic visual text interface
Megacli-ldinit-progdsply-lall–aall
5.2 Viewing the background initialization progress of the array
Megacli-ldbi-showprog-lall-aall
or display it in a dynamic visual text interface
Megacli-ldbi-progdsply-lall-aall
6. Create a global hot spare
Specify 5th disk as global hot spare
Megacli-pdhsp-set [-enclaffinity] [-nonrevertible]-physdrv[1:5]-a0
You can also specify a dedicated hot spare for an array
Megacli-pdhsp-set [-dedicated [-array1]] [-enclaffinity] [-nonrevertible]-physdrv[1:5]-a0
7. Delete Global Hot spare
Megacli-pdhsp-rmv-physdrv[1:5]-a0
8, will be a physical disk offline/on-line
Megacli-pdoffline-physdrv [1:4]-a0
Megacli-pdonline-physdrv [1:4]-a0
9. View Physical Disk Rebuild progress
Megacli-pdrbld-showprog-physdrv [1:5]-a0
Ubuntu Installation Megacli