MegaCLI working examples cheat sheet
MegaCLI is a pain… a real pain. I’m not a fan of the syntax, it’s not easily readable, did I say it was a pain?
Well, our OCP Knox Units are connected via the LSI MEGARAID SAS 9286CV-8E (SGL) controller, so I’ve been using MegaCLI quite a bit lately. Here is a collection of my working examples:
List All Devices
./MegaCLI -PDList -aALL | egrep 'Adapter|Enclosure|Slot|Inquiry'
Create raid 1 volume with disk 0 and 1
./MegaCLI -CfgLdAdd -r1' [38:0,38:1]' -a0
Create raid 5 volume with disk 0-14
./MegaCLI -CfgLdAdd -r5 '[38:0,38:1,38:2,38:3,38:4,38:5,38:6,38:7,38:8,38:9,38:10,38:11,38:12,38:13,38:14]' -a0 -NoLog
Create individual raid 0 volumes on drives 2-14
i=2; while [ $i -le 14 ] ; do ./MegaCli -cfgldadd -r0 [38:${i}] WB RA Cached CachedBadBBU -strpsz512 -a0 -NoLog ; i=`expr $i + 1`; done
List all volumes
./MegaCli -LDInfo -Lall -aALL
Create raid 50 volume
./MegaCli -CfgSpanAdd -r50 -Array0[38:0,38:1,38:2,38:3,38:4,38:5] -Array1[38:6,38:7,38:8,38:9,38:10,38:11] Direct RA WB -a0
Bring physical drive 14 online
./MegaCli -PDMakeGood -PhysDrv[38:14] -a0
Show physical drive status
./MegaCli -PDList -a0
Enable JBOD support – this is necessary for vSphere vSAN technology
./MegaCli -AdpSetProp -EnableJBOD 1 -aALL
Set global hot spare
./MegaCli -PDHSP -SET -PhysDrv [38:14] -a0
Delete all volumes
./MegaCli -CfgLdDel -Lall -aAll
Clear foreign configs
./MegaCli -CfgForeign -Clear -aALL
List drive state
./MegaCli pdlist -a0 | grep 'Firmware state'
Enable drive location LED
./MegaCli -PdLocate -start -physdrv[64:0] -a0
Tags: Knox Unit, KnoxUnit, LSI, MegaCLI, OCP, Open Compute, opencompute