From Lyceum
Jump to: navigation, search

Getting Started

LSI offers the MegaRAID CLI tool, which is a bit cryptic to use. Here are some pointers to get started with it.

Download it from the LSI website - look for a recent version of MegaRAID CLI, for example here.

Quick reference guide is available here

Some other helpful resources:


Einarc may be a good alternative to the megaraid CLI. It provides a unified intereface to various RAID devices with a better interface


Here is another blog post with some helpful hints:

List all drives, then get info on a specific one:

[root@host]# /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL > pdlist.txt
[root@host]# /opt/MegaRAID/MegaCli/MegaCli64 -PDInfo -PhysDrv[0:4]

Other Interesting stuff:

[root@host]# /opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL
[root@host]# /opt/MegaRAID/MegaCli/MegaCli64  -AdpEventLog -GetEvents -f events.log -aALL && cat events.log
[root@host]# /opt/MegaRAID/MegaCli/MegaCli64 -CfgDdsply -a2 > cfgdsply.txt

Replacing a drive.

From the above referenced quick reference by Moritz Mertinkat, the steps to replace a drive would be:

8 Walkthrough: Change/replace a drive

   1. Set the drive offline, if it is not already offline due to an error

      MegaCli -PDOffline -PhysDrv [E:S] -aN
   2. Mark the drive as missing

      MegaCli -PDMarkMissing -PhysDrv [E:S] -aN
   3. Prepare drive for removal

      MegaCli -PDPrpRmv -PhysDrv [E:S] -aN
   4. Change/replace the drive
   5. If you’re using hot spares then the replaced drive should become your new hot spare drive

      MegaCli -PDHSP -Set -PhysDrv [E:S] -aN
   6. In case you’re not working with hot spares, you must re-add the new drive to your RAID virtual drive and start the rebuilding

      MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN
      MegaCli -PDRbld -Start -PhysDrv [E:S] -aN 

Another good resource is here showing for example how to determine the arguments to use to run a rebuild on an array when a new drive is not automatically recognized.

MegaCli and smartctl

To get the device ID within the array, say if you know per Dell OpenMange that the drive is in slot 4, query with:

[root@daacdb1 smartmontools-5.40]# /opt/MegaRAID/MegaCli/MegaCli64 -PDInfo -PhysDrv[0:4] -aAll
Enclosure Device ID: 0
Slot Number: 4
Device Id: 11  <==
Sequence Number: 4
Media Error Count: 0
Other Error Count: 6
Predictive Failure Count: 1

From the above, we learn this failed drive is device ID 11, so we can now query it using smartctl to see the full smart info:

[root@server smartmontools-5.40]# /usr/local/sbin/smartctl -a -d megaraid,11 /dev/sdc

(Note this requires a recent version of smartmontools.)

Another Example

 /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL > pdlist.txt
 grep -B 20 -A 10 -i unconfigured pdlist.txt 
 egrep 'Adapter|Enclosure|Slot|Inquiry|Device Id|Firmware state' pdlist.txt 

From the above we learn Enclosure Device ID: 32 and Device Id: 28 for the failed device.

 /opt/MegaRAID/MegaCli/MegaCli64  -PDInfo -PhysDrv [32:28] -a0

You can then try to view smartinfo (if drive is online)

 smartctl -a -d sat+megaraid,28 -T permissive /dev/sda