ARTICLES

LSI MEGARAID COMMAND LINE UTILITY

 

LSI makes some great hardware RAID controllers, and one of the best things about them are, as I learned recently, you can replace disks that have failed while the server is still running (assuming you have the pull out quick release drive bays), and rebuild the RAID using this utility without any downtime. Score.

Firstly, get the software - for VMWare here - you only need to unzip it to the server and then run it like so:

 

./MegaCli put commands here

For Linux here - there are two rpms, so install them with the commands:

yum install Lib_Utils-1.00-09.noarch.rpm MegaCli-8.02.16-1.i386.rpm

The Lib_Utils is needed as a prerequisite. This installs the MegaCli64 executable in /opt/MegaRAID/MegaCli but it doesn't add a symlink to /sbin, so go to /sbin and then run the following command so you don't have to search out this obscur location:

cd /sbin

ln -s /opt/MegaRAID/MegaCli/MegaCli64 MegaCli64

As the servers were constantly beeping, to silence the beeping run the following command (note in VMWare, use ./MegaCli instead of MegaCli64)

MegaCli64 AdpSetProp AlarmSilence a0

This silences the alarm on this occasion for controller a0. You can also specify aALL if you have more than one controller and you want it to apply globally.

To disable the alarm completely, select

MegaCli64 AdpSetProp AlarmDsbl a0

to reenable:

MegaCli64 AdpSetProp AlarmEnbl a0

to check on the status of the drives, you can do:

MegaCli64 -PDList -aALL

or to find out exactly which drives are failed or online:

MegaCli64 -PDList -aALL | grep "Firmware state"

It should say "rebuild" once you have put in the new drive.

How to Rebuild a Drive That is Marked as "Foreign" When Inserted:

Note  - E = enclosure and S = slot. You can check these details with the -PDList command above

MegaCli64 -PDMakeGood -PhysDrv\[E:S\] -aALL

MegaCli64 -CfgForeign -Clear -aALL

MegaCli64 -PDHSP -Set -PhysDrv \[E:S\] -aALL # make this unconfigured drive a hot spare

Removing a drive and putting it right back onto the same RAID controller will cause the drive to marked as "Foreign". A drive in the "Foreign" state is not usable in an array.

Find the drive that is not "Online" which should be the newly replaced drive.

Show the first few lines of output for each drive to help locate the one that is in a "Foreign" state:

MegaCli64 -PDList -aALL | grep "Firmware state"

Manually inspect the output for the drive where "Firmware state" is not "Online". Drives that are already removed will not show up in this list.

Look at the single drive:

MegaCli64 -PdInfo -PhysDrv \[E:S\] -aALL