RAID: Using MegaCli, the LSI command line interface

From Define Wiki
Revision as of 13:06, 25 February 2013 by David (talk | contribs) (→‎Virtual drive management)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Note:

  • Adapter parameter -aN
     The parameter -aN (where N is a number starting with zero or the string ALL) specifies the
     adapter ID. If you have only one controller it’s safe to use ALL instead of a specific ID, 
     use the ID for everything that makes changes to your RAID configuration whenever possible.
  • Physical drive parameter -PhysDrv [E:S]
     For commands that operate on one or more pysical drives, the -PhysDrv [E:S] parameter is used,
     where E is the enclosure device ID in which the drive resides and S the slot number
     (starting with zero). You can get the enclosure device ID using „MegaCli -EncInfo -aALL“. The
     E:S syntax is also used for specifying the physical drives when creating a new RAID 
     virtual drive (see 5).
  • Virtual drive parameter -Lx
     The parameter -Lx is used for specifying the virtual drive (where x is a number starting with
     zero or the string all).

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.

This needs to be done when reusing disks form old arrays

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

LSI MegaRAID

  • MegaCli64 -EncInfo -a0 # Enclosure info and ID
  • MegaCli64 -PDGetNum -a0 # Number of Physical Drives on Adapter 0
  • MegaCli64 –LDInfo –Lall –aALL
  • MegaCli64 –AdpAllInfo –aALL
  • MegaCli64 -PDList –aALL
  • MegaCli64 –pdInfo -aALL
  • MegaCli64 -adpcount
  • MegaCli64 -LDPDInfo -aAll
  • MegaCli -AdpBbuCmd -aALL
  • MegaCli64 -PDRbld -ShowProg -PhysDrv \[4:2\] –aALL (not tested)
  • MegaCli64 -PDHSP -set -PhysDrv[4:3] -a0 (set enclosure device id 4, slot 3, of array 0 to be the new global hot spare)
  • MegaCli64 -AdpSetProp AlarmSilence -a0 (silence the alarm)
  • MegaCli64 -AdpEventLog -GetEvents -f eventlog -aALL (Dump all events from the adapter to eventlog file)


LSI 92xx Firmware Update

  • MegaCli64 –AdpFwFlash –f SAS1078_FW_Image.rom –a0 (Flashing FW)
  • MegaCli64 -AdpFwFlash -f filename [-NoSigChk] [-NoVerChk] -aN|-a0,1,2
[root@fido0 12.12.0-0090_SAS_2108_FW_Image_APP-2.120.243-1482]# MegaCli64 -AdpFwFlash -f mr2108fw.rom -a0
                                     
Adapter 0: LSI MegaRAID SAS 9280-4i4e
Vendor ID: 0x1000, Device ID: 0x0079

Package version on the controller: 12.7.0-0007 
Package version of the image file: 12.12.0-0090 
Download Completed.     
Flashing image to adapter...
Adapter 0: Flash Completed.

Exit Code: 0x00
[root@fido0 12.12.0-0090_SAS_2108_FW_Image_APP-2.120.243-1482]#