Monday, June 17, 2013

MegaRAID

Just a little something a bud and myself experienced with the cryptic MegaRAID cli commands and if you happen to hate the MegaRAID WebBios like most people do and that would include myself.

MegaCli64 important parameters
-aX or All, where X is the adapter number 0 or 1, etc
-PhysDrv [E:S] refers to the particular physical disk, where E is the enclosure ID and S is the slot number of the physical disk
To find out what is the enclosure ID, refer to the enclosure info output
e.g.
 In case there is a single LSI MegaRAID adapter, if the enclosure ID is 252 and the disk that is supposed to be replaced is Slot 5 (in actual fact it is Slot 6, the slot number starts from 0). So the format of the [E:S] is [252:5].

- To view adapter info, this will tell you how many LSI MegaRAID adapters are there installed
MegaCli64 -AdpAllInfo -aAll

- To view the enclosure info
MegaCli -EncInfo -aALL

- To view the list of all virtual disks that is connected to the LSI MegaRAID adapters
MegaCli64 -LDInfo -Lall -aALL

- To view the list of all physical disks that is connected to the LSI MegaRAID adapters
MegaCli64 -PDList -aALL

- To view the information of a particular physical disk
MegaCli64 -PDInfo -PhysDrv [E:S] -aALL

- To set the state of a particular disk to offline
MegaCli64 -PDOffline -PhysDrv [E:S] -aX

- To set the state of a particular disk to online
MegaCli64 -PDOnline -PhysDrv [E:S] -aX

- To mark a physical disk as missing, used specifically for disk replacement
MegaCli64 -PDMarkMissing -PhysDrv [E:S] -aX

- To prepare a physical for removal
MegaCli64 -PDPrpRmv -PhysDrv [E:S] -aX

- To replace a missing drive
MegaCli64 -PDReplaceMissing -PhysDrv [E:S] -ArrayM -rowN -aX

- To rebuild a drive
MegaCli64 -PDRbld -Start -PhysDrv [E:S] -aX
MegaCli64 -PDRbld -Stop -PhysDrv [E:S] -aX
MegaCli64 -PDRbld -ShowProg - PhysDrv [E:S] -aX

- To change the status of particular disk from bad to good, or from Unconfigured-Bad to Unconfigured-Good, this is especially useful when a disk has been removed abruptly without properly removing the disk from a particular virtual drive by abruptly pluggin the disk out of it's slot
MegaCli64 -PDMakeGood -PhysDrv [E:S] -aX


To change/replace a drive that is a part of a mirror logical disk
- In the case of the disk replacement we did in RHB, the faulty disk is on slot 5 (6th slot) on enclosure with the ID of 252 on adapter 0

1. Set the drive offline, if it is already not offline
MegaCli64 -PDOffline -PhysDrv [252:5] -a0

2. Mark the drive as missing
MegaCli64 -PDMarkMissing -PhysDrv [252:5] -a0

3. Prepare drive for removal
MegaCli64 -PDPrpRmv -PhysDrv [252:5] -a0

4. Physically remove the disk from the slot, and plug in the new disk

5. Add the new disk back to the affected virtual drive and start rebuilding.
MegaCli64 -PDReplaceMissing -PhysDrv [252:5] -Array2 -row1 -a0
MegaCli64 -PDRbld -Start -PhysDrv [252:5] -a0

6. To view the progress of the rebuild 
MegaCli64 -PDRbld -ShowProg -PhysDrv [252:5] -a0

A note on step 4, how do you find out which Array number was affected by the bad disk, we can get find this out by viewing the status of all the logical disk configured on the HBA card (by running MegaCli64 -LDInfo -Lall -aALL) the status of the logical drive should have been marked as degraded.

Another note on step 4, how do you want to now which row the disk is logically at (this row number does not correspond to the slot number). You can find this out by running (MegaCli –PdGetMissing -a0, hopefully you won't have more that one disk missing/removed manually by your goodself)

To replace a drive that is the designated hotspare on a RAID-5 logical disk, well maybe next time.

No comments: