Megacli Cheat Sheet

Show Logical disk

MegaCli -LDinfo -Lx -aN

Show all Physical disk

MegaCli -PDList -aN

Delete Raid


MegaCli -CfgLdDel -Lx -aN

Make JBOD


MegaCli -PDMakeJBOD -PhysDrv[Encrosure:diskID] -aN

Check Disks Status

# check disk status
MegaCli -PDlist -aALL -NoLog | egrep 'Slot|state' | awk '/Slot/{if (x)print x;x="";}{x=(!x)?$0:x" -"$0;}END{print x;}' | sed 's/Firmware state://g'
  

Bring Bad Disk to Good


MegaCli -PDMakeGood -PhysDrv[E:S] -aN

Bring Unconfiguration(good) to Online

MegaCli -PDOnline -PhysDrv [E:S] -aN 

Scan and Clear Foreign

#Bring bad to good
MegaCli -CfgForeign -Scan -aALL 
MegaCli -CfgForeign -Clear -aALL

Import Foreign

megaCli -CfgForeign -Import -a0

Check Disk Information

MegaCli -PDList -aALL
MegaCli -PDInfo -PhysDrv [E:S] -aALL 

MegaCli -AdpAllInfo -aAll
MegaCli -LDInfo -Lall -aALL

Upgrade Firmware with local file

MegaCli -adpfwflash -f mr2208fw.rom -a0

Raid0 & Raid 1

MegaCli -cfgldadd -r1[252:0,252:1] -a0

MegaCli -cfgldadd -r0[252:2] -a0
MegaCli -cfgldadd -r0[252:3] -a0
MegaCli -cfgldadd -r0[252:4] -a0
MegaCli -cfgldadd -r0[252:5] -a0

Disk Cache

MegaCli -LDSetProp -WT -Immediate -L[1-2-3-4] -aAll
MegaCli -LDSetProp EnDskCache -L[1-2-3-4] -aAll