MegaCli
Check raid card:
lspci | grep -i raid
Ubuntu/Debian:
wget http://hwraid.le-vert.net/debian/pool-jessie/megacli_8.07.14-1_amd64.deb
dpkg -i megacli_8.07.14-1_amd64.deb
CentOS/Other:
Clear all config
-CfgLdDel -Lall -aAll
-CfgClr -aAll
Physical drive information
-PDList -aALL
-PDInfo -PhysDrv [E:S] -aALL
Virtual drive information
-LDInfo -Lall -aALL
Enclosure information.
-EncInfo -aALL
Set physical drive state to online
-PDOnline -PhysDrv[E:S] -aALL
Stop Rebuild manually on the drive
-PDRbld -Stop -PhysDrv[E:S] -aALL
Show rebuild progress
-PDRbld -ShowProg -PhysDrv[E:S] -aALL
View dead disks (offline or missing)
-ldpdinfo -aall |grep -i “firmware state\|slot”
View new disks
-pdlist -aall |grep -i “firmware\|unconfigured\|slot”
Create raid 1:
-CfgLdAdd -r1 [E:S, E:S] -aN
Create raid 0:
-CfgLdAdd -r0 [E:S, E:S] -aN
Init ALL VDs
-LDInit -Start -LALL -a0
Init 1 VD
-LDInit -Start -L[VD_ID] -a0
clearcache
-DiscardPreservedCache -L3 -aN (3 being the VD number)
Check FW
-AdpAllInfo -aALL | grep 'FW Package Build'
Flash FW
-AdpFwFlash -f <Your rom file> -a0
Flash FW to older version
-adpfwflash -f $ROMFILE -noverchk -a0
Check BBU
-AdpBbuCmd -a0
Flash LED on HDD
-PdLocate -start -physdrv[E:S] -aALL
-PdLocate -stop -physdrv[E:S] -aALL
Scan Foreign
-CfgForeign -Scan -a0
Import Foreign
-cfgforeign -import -a0
Bad to Good
MegaCli -PDMakeGood -PhysDrv[E:S] -aN
Disable auto rebuild
-AdpAutoRbld -Dsbl -a0
Enable auto rebuild
-AdpAutoRbld -Enbl -a0
JBOD
Figure out the Enclosure Device ID
-PDList -a0 | grep -e '^Enclosure Device ID:' | head -1 | cut -f2- -d':' | xargs
Set all the drives to “Good”
-PDMakeGood -PhysDrv[$id:1,$id:2,$id:3,$id:4,$id:5,$id:6,$id:7,$id:8] -Force -a0
Check and see if JBOD support is enabled
AdpGetProp EnableJBOD -aALL
Turn JBOD support on
AdpSetProp EnableJBOD 1 -a0
Set each disk from above to be in JBOD mode
-PDMakeJBOD -PhysDrv[$id:1,$id:2,$id:3,$id:4,$id:5,$id:6,$id:7,$id:8] -a0
The syntax for checking a disk within a MegaRAID based controller is as follows via CLI:
This shows the "Device ID: X", Replace n with the Device ID
-LdPdInfo -a0 | grep Id
smartctl -a -d sat+megaraid,n /dev/sg0