MegaCli: LSI Command Line Tool commands

From Define Wiki
Revision as of 12:46, 12 July 2012 by Jon (talk | contribs)
Jump to navigation Jump to search

Gather information

  • Controller information
MegaCli -AdpAllInfo -aALL
MegaCli -CfgDsply -aALL
MegaCli -AdpEventLog -GetEvents -f events.log -aALL && cat events.log
  • Enclosure information
MegaCli -EncInfo -aALL
  • Virtual drive information
MegaCli -LDInfo -Lall -aALL
  • Physical drive information
MegaCli -PDList -aALL
MegaCli -PDInfo -PhysDrv [E:S] -aALL [-pageN where N is the number of pages to display]
  • Battery backup information
MegaCli -AdpBbuCmd -aALL

Controller management

  • Silence active alarm
MegaCli -AdpSetProp AlarmSilence -aALL
  • Disable alarm
MegaCli -AdpSetProp AlarmDsbl -aALL
  • Enable alarm
MegaCli -AdpSetProp AlarmEnbl -aALL

Virtual drive management

  • Create RAID 0, 1, 5 drive
MegaCli -CfgLdAdd -r(0|1|5|6) [E:S, E:S, ...] -aN

'''Eg: all default settings'''
MegaCli64 -CfgLdAdd -r0 [4:2,4:3, 4:4, 4:5, 4:6, 4:7, 4:8, 4:9, 4:10, 4:11, 4:12, 4:13, 4:14,
4:15, 4:16, 4:17, 4:18, 4:19, 4:20, 4:21, 4:22, 4:23] -a0

'''Eg: Write=WriteBack, Read=Adaptive, IO=direct, CacheBadBBU'''
MegaCli64 -CfgLdAdd -r0 [4:2,4:3, 4:4, 4:5, 4:6, 4:7, 4:8, 4:9, 4:10, 4:11, 4:12, 4:13, 4:14,
4:15, 4:16, 4:17, 4:18, 4:19, 4:20, 4:21, 4:22, 4:23] WB ADRA Direct CachedBadBBU -a0
  • Create RAID 10 drive
MegaCli -CfgSpanAdd -r10 -Array0[E:S,E:S] -Array1[E:S,E:S] -aN
  • Remove drive
MegaCli -CfgLdDel -Lx -aN
  • Remove all logical drives
MegaCli -CfgLdDel -LALL -aALL
  • Create RAID6 array across 24 drives
MegaCli -CfgLdAdd -r6 [0:0,0:1,0:2,0:3,0:4,0:5,0:6,0:7,0:8,0:9,0:10,0:11,0:12,0:13,0:14,0:15,0:16,0:17,0:18,0:19,0:20,0:21,0:22,0:23] WB ADRA Direct -a0
  • Check the RAID initialisation progress
[root@localhost MegaCli]# ./MegaCli64 -ldinfo -Lall -aALL | grep -i init
Background Initialization: Completed 1%, Taken 14 min.
  • Creating a JBOD, note, couldn't create JBOD with 9260-4i controller, had to create R0 single disks:
[root@localhost MegaCli]$ ./MegaCli64 -AdpAllinfo -aALL  | grep -i jbod
Enable JBOD                             : No
Enable JBOD                      : No

[root@localhost MegaCli]$ cat create_jbod.sh 
#!/bin/bash

for ((i=0; i<24; i++))
do
    ./MegaCli64 -CfgLdAdd -r0 [0:$i] -a0
done

[root@localhost MegaCli]$ ./create_jbod.sh
Adapter 0: Created VD 0

Adapter 0: Configured the Adapter!!

Exit Code: 0x00
.. [etc]
  • Found another command to create RAID0 disks (Rather than script)
./MegaCli64 -CfgEachDskRaid0 WT NORA Direct NoCachedBadBBU -a0

Adapter 0: Created VD 0
Configured physical device at Encl-0:Slot-0.
Adapter 0: Created VD 1
Configured physical device at Encl-0:Slot-1.
  • Clear all foreign drives
MegaCli -CfgForeign -Clear -aN

Physical drive management

  • Set state to offline
     MegaCli -PDOffline -PhysDrv [E:S] -aN
  • Set state to online
     MegaCli -PDOnline -PhysDrv [E:S] -aN
  • Mark as missing
     MegaCli -PDMarkMissing -PhysDrv [E:S] -aN
  • Prepare for removal
     MegaCli -PdPrpRmv -PhysDrv [E:S] -aN
  • Replace missing drive
     MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN
     The number N of the array parameter is the Span Reference you get using „MegaCli -CfgDsply
     -aALL“ and the number N of the row parameter is the Physical Disk in that span or array
     starting with zero (it’s not the physical disk’s slot!).
  • Rebuild drive
     MegaCli -PDRbld -Start -PhysDrv [E:S] -aN
     MegaCli -PDRbld -Stop -PhysDrv [E:S] -aN
     MegaCli -PDRbld -ShowProg -PhysDrv [E:S] -aN
  • Clear drive
     MegaCli -PDClear -Start -PhysDrv [E:S] -aN
     MegaCli -PDClear -Stop -PhysDrv [E:S] -aN
     MegaCli -PDClear -ShowProg -PhysDrv [E:S] -aN
  • Bad to good
     MegaCli -PDMakeGood -PhysDrv[E:S] -aN
     Changes drive in state Unconfigured-Bad to Unconfigured-Good. 
  • Drives appear as FOREIGN (either part of old/other raid pack)
     MegaCli64 -CfgForeign -Scan -Clear

Hot spare management

  • Set global hot spare
     MegaCli -PDHSP -Set -PhysDrv [E:S] -aN
  • Remove hot spare
     MegaCli -PDHSP -Rmv -PhysDrv [E:S] -aN
  • Set dedicated hot spare
     MegaCli -PDHSP -Set -Dedicated -ArrayN,M,... -PhysDrv [E:S] -aN 

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