Difference between revisions of "MegaCli: LSI Command Line Tool commands"

From Define Wiki
Jump to navigation Jump to search
(Created page with "==== Gather information ==== * Controller information MegaCli -AdpAllInfo -aALL MegaCli -CfgDsply -aALL MegaCli -AdpEventLog -GetEvents -f events.log -aALL ...")
 
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
==== Gather information ====
+
== Gather information ==
  
 
* Controller information
 
* Controller information
      MegaCli -AdpAllInfo -aALL
+
<syntaxhighlight>
      MegaCli -CfgDsply -aALL
+
MegaCli -AdpAllInfo -aALL
      MegaCli -AdpEventLog -GetEvents -f events.log -aALL && cat events.log
+
MegaCli -CfgDsply -aALL
 +
MegaCli -AdpEventLog -GetEvents -f events.log -aALL && cat events.log
 +
</syntaxhighlight>
  
 
* Enclosure information
 
* Enclosure information
      MegaCli -EncInfo -aALL
+
<syntaxhighlight>
 +
MegaCli -EncInfo -aALL
 +
</syntaxhighlight>
  
 
* Virtual drive information
 
* Virtual drive information
      MegaCli -LDInfo -Lall -aALL
+
<syntaxhighlight>
 +
MegaCli -LDInfo -Lall -aALL
 +
</syntaxhighlight>
  
 
* Physical drive information
 
* Physical drive information
      MegaCli -PDList -aALL
+
<syntaxhighlight>
      MegaCli -PDInfo -PhysDrv [E:S] -aALL [-pageN where N is the number of pages to display]
+
MegaCli -PDList -aALL
 +
MegaCli -PDInfo -PhysDrv [E:S] -aALL [-pageN where N is the number of pages to display]
 +
</syntaxhighlight>
  
 
* Battery backup information
 
* Battery backup information
      MegaCli -AdpBbuCmd -aALL  
+
<syntaxhighlight>
 +
MegaCli -AdpBbuCmd -aALL  
 +
</syntaxhighlight>
  
==== Controller management ====
+
== Controller management ==
  
 
* Silence active alarm
 
* Silence active alarm
      MegaCli -AdpSetProp AlarmSilence -aALL
+
<syntaxhighlight>
 +
MegaCli -AdpSetProp AlarmSilence -aALL
 +
</syntaxhighlight>
  
 
* Disable alarm
 
* Disable alarm
      MegaCli -AdpSetProp AlarmDsbl -aALL
+
<syntaxhighlight>
 +
MegaCli -AdpSetProp AlarmDsbl -aALL
 +
</syntaxhighlight>
  
 
* Enable alarm
 
* Enable alarm
      MegaCli -AdpSetProp AlarmEnbl -aALL  
+
<syntaxhighlight>
 +
MegaCli -AdpSetProp AlarmEnbl -aALL  
 +
</syntaxhighlight>
  
==== Virtual drive management ====
+
== Virtual drive management ==
  
 
* Create RAID 0, 1, 5 drive
 
* Create RAID 0, 1, 5 drive
      MegaCli -CfgLdAdd -r(0|1|5|6) [E:S, E:S, ...] -aN
+
<syntaxhighlight>
      '''Eg: all default settings'''
+
MegaCli -CfgLdAdd -r(0|1|5|6) [E:S, E:S, ...] -aN
      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: all default settings'''
      '''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,
      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
      4:15, 4:16, 4:17, 4:18, 4:19, 4:20, 4:21, 4:22, 4:23] WB ADRA Direct CachedBadBBU -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
 +
</syntaxhighlight>
  
 
* Create RAID 10 drive
 
* Create RAID 10 drive
      MegaCli -CfgSpanAdd -r10 -Array0[E:S,E:S] -Array1[E:S,E:S] -aN
+
<syntaxhighlight>
 +
MegaCli -CfgSpanAdd -r10 -Array0[E:S,E:S] -Array1[E:S,E:S] -aN
 +
</syntaxhighlight>
  
 
* Remove drive
 
* Remove drive
      MegaCli -CfgLdDel -Lx -aN
+
<syntaxhighlight>
 +
MegaCli -CfgLdDel -Lx -aN
 +
</syntaxhighlight>
  
 
* Remove all logical drives
 
* Remove all logical drives
      MegaCli -CfgLdDel -LALL -aALL
+
<syntaxhighlight>
 +
MegaCli -CfgLdDel -LALL -aALL
 +
</syntaxhighlight>
  
 
* Create RAID6 array across 24 drives
 
* 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
+
<syntaxhighlight>
 +
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
 +
</syntaxhighlight>
  
 
* Check the RAID initialisation progress
 
* Check the RAID initialisation progress
      [root@localhost MegaCli]# ./MegaCli64 -ldinfo -Lall -aALL | grep -i init
+
<syntaxhighlight>
      Background Initialization: Completed 1%, Taken 14 min.
+
[root@localhost MegaCli]# ./MegaCli64 -ldinfo -Lall -aALL | grep -i init
 +
Background Initialization: Completed 1%, Taken 14 min.
 +
</syntaxhighlight>
  
 
* Creating a JBOD, '''note''', couldn't create JBOD with 9260-4i controller, had to create R0 single disks:
 
* Creating a JBOD, '''note''', couldn't create JBOD with 9260-4i controller, had to create R0 single disks:
 +
<syntaxhighlight>
 +
[root@localhost MegaCli]$ ./MegaCli64 -AdpAllinfo -aALL  | grep -i jbod
 +
Enable JBOD                            : No
 +
Enable JBOD                      : No
  
      [root@localhost MegaCli]$ ./MegaCli64 -AdpAllinfo -aALL  | grep -i jbod
+
[root@localhost MegaCli]$ cat create_jbod.sh  
      Enable JBOD                            : No
+
#!/bin/bash
      Enable JBOD                      : No
 
<syntaxhighlight>
 
      [root@localhost MegaCli]$ cat create_jbod.sh  
 
      #!/bin/bash
 
  
      for ((i=0; i<24; i++))
+
for ((i=0; i<24; i++))
      do
+
do
          ./MegaCli64 -CfgLdAdd -r0 [0:$i] -a0
+
    ./MegaCli64 -CfgLdAdd -r0 [0:$i] -a0
      done
+
done
  
      [root@localhost MegaCli]$ ./create_jbod.sh
+
[root@localhost MegaCli]$ ./create_jbod.sh
      Adapter 0: Created VD 0
+
Adapter 0: Created VD 0
  
      Adapter 0: Configured the Adapter!!
+
Adapter 0: Configured the Adapter!!
  
      Exit Code: 0x00
+
Exit Code: 0x00
      .. [etc]
+
.. [etc]
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Found another command to create RAID0 disks (Rather than script)
+
* Found another command to create RAID0 disks (Rather than script)
 
<syntaxhighlight>
 
<syntaxhighlight>
      ./MegaCli64 -CfgEachDskRaid0 WT NORA Direct NoCachedBadBBU -a0
+
./MegaCli64 -CfgEachDskRaid0 WT NORA Direct NoCachedBadBBU -a0
  
      Adapter 0: Created VD 0
+
Adapter 0: Created VD 0
      Configured physical device at Encl-0:Slot-0.
+
Configured physical device at Encl-0:Slot-0.
      Adapter 0: Created VD 1
+
Adapter 0: Created VD 1
      Configured physical device at Encl-0:Slot-1.
+
Configured physical device at Encl-0:Slot-1.
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Clear all foreign drives
+
* Clear all foreign drives
 
<syntaxhighlight>
 
<syntaxhighlight>
    MegaCli -CfgForeign -Clear -aN
+
MegaCli -CfgForeign -Clear -aN
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==== Physical drive management ====
+
== Physical drive management ==
  
 
* Set state to offline
 
* Set state to offline
      MegaCli -PDOffline -PhysDrv [E:S] -aN
+
<syntaxhighlight>
 +
MegaCli -PDOffline -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
 
* Set state to online
 
* Set state to online
      MegaCli -PDOnline -PhysDrv [E:S] -aN
+
<syntaxhighlight>
 +
MegaCli -PDOnline -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
 
* Mark as missing
 
* Mark as missing
      MegaCli -PDMarkMissing -PhysDrv [E:S] -aN
+
<syntaxhighlight>
 +
MegaCli -PDMarkMissing -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
 
* Prepare for removal
 
* Prepare for removal
      MegaCli -PdPrpRmv -PhysDrv [E:S] -aN
+
<syntaxhighlight>
 +
MegaCli -PdPrpRmv -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
 
* Replace missing drive
 
* Replace missing drive
      MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN
+
<syntaxhighlight>
      The number N of the array parameter is the Span Reference you get using „MegaCli -CfgDsply
+
MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN
      -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!).
+
# 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!).
 +
</syntaxhighlight>
  
 
* Rebuild drive
 
* Rebuild drive
 
+
<syntaxhighlight>
      MegaCli -PDRbld -Start -PhysDrv [E:S] -aN
+
MegaCli -PDRbld -Start -PhysDrv [E:S] -aN
      MegaCli -PDRbld -Stop -PhysDrv [E:S] -aN
+
MegaCli -PDRbld -Stop -PhysDrv [E:S] -aN
      MegaCli -PDRbld -ShowProg -PhysDrv [E:S] -aN
+
MegaCli -PDRbld -ShowProg -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
 
* Clear drive
 
* Clear drive
      MegaCli -PDClear -Start -PhysDrv [E:S] -aN
+
<syntaxhighlight>
      MegaCli -PDClear -Stop -PhysDrv [E:S] -aN
+
MegaCli -PDClear -Start -PhysDrv [E:S] -aN
      MegaCli -PDClear -ShowProg -PhysDrv [E:S] -aN
+
MegaCli -PDClear -Stop -PhysDrv [E:S] -aN
 +
MegaCli -PDClear -ShowProg -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
 
* Bad to good
 
* Bad to good
      MegaCli -PDMakeGood -PhysDrv[E:S] -aN
+
<syntaxhighlight>
      Changes drive in state Unconfigured-Bad to Unconfigured-Good.  
+
MegaCli -PDMakeGood -PhysDrv[E:S] -aN
 +
 
 +
# Changes drive in state Unconfigured-Bad to Unconfigured-Good.  
 +
</syntaxhighlight>
  
 
* Drives appear as FOREIGN (either part of old/other raid pack)  
 
* Drives appear as FOREIGN (either part of old/other raid pack)  
      MegaCli64 -CfgForeign -Scan -Clear
+
<syntaxhighlight>
 +
MegaCli64 -CfgForeign -Scan -Clear
 +
</syntaxhighlight>
  
==== Hot spare management ====
+
== Hot spare management ==
  
 
* Set global hot spare
 
* Set global hot spare
      MegaCli -PDHSP -Set -PhysDrv [E:S] -aN
+
<syntaxhighlight>
 +
MegaCli -PDHSP -Set -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
 
* Remove hot spare
 
* Remove hot spare
      MegaCli -PDHSP -Rmv -PhysDrv [E:S] -aN
+
<syntaxhighlight>
 +
MegaCli -PDHSP -Rmv -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
 
* Set dedicated hot spare
 
* Set dedicated hot spare
      MegaCli -PDHSP -Set -Dedicated -ArrayN,M,... -PhysDrv [E:S] -aN  
+
<syntaxhighlight>
 +
MegaCli -PDHSP -Set -Dedicated -ArrayN,M,... -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
==== Walkthrough: Change/replace a drive ====
+
== Walkthrough: Change/replace a drive ==
  
  1. Set the drive offline, if it is not already offline due to an error
+
* Set the drive offline, if it is not already offline due to an error
      MegaCli -PDOffline -PhysDrv [E:S] -aN
+
<syntaxhighlight>
 +
MegaCli -PDOffline -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
  2. Mark the drive as missing
+
* Mark the drive as missing
      MegaCli -PDMarkMissing -PhysDrv [E:S] -aN
+
<syntaxhighlight>
 +
MegaCli -PDMarkMissing -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
  3. Prepare drive for removal
+
* Prepare drive for removal
      MegaCli -PDPrpRmv -PhysDrv [E:S] -aN
+
<syntaxhighlight>
 +
MegaCli -PDPrpRmv -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
  4. Change/replace the drive
+
* Change/replace the drive
  
  5. If you’re using hot spares then the replaced drive should become your new hot spare drive
+
* If you’re using hot spares then the replaced drive should become your new hot spare drive
      MegaCli -PDHSP -Set -PhysDrv [E:S] -aN
+
<syntaxhighlight>
 +
MegaCli -PDHSP -Set -PhysDrv [E:S] -aN
 +
</syntaxhighlight>
  
  6. In case you’re not working with hot spares, you must re-add the new drive to your RAID virtual
+
* 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
      drive and start the rebuilding
+
<syntaxhighlight>
 
+
MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN
      MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN
+
MegaCli -PDRbld -Start -PhysDrv [E:S] -aN
      MegaCli -PDRbld -Start -PhysDrv [E:S] -aN
+
</syntaxhighlight>

Latest revision as of 13:18, 8 August 2012

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

  • Set the drive offline, if it is not already offline due to an error
MegaCli -PDOffline -PhysDrv [E:S] -aN
  • Mark the drive as missing
MegaCli -PDMarkMissing -PhysDrv [E:S] -aN
  • Prepare drive for removal
MegaCli -PDPrpRmv -PhysDrv [E:S] -aN
  • Change/replace the drive
  • If you’re using hot spares then the replaced drive should become your new hot spare drive
MegaCli -PDHSP -Set -PhysDrv [E:S] -aN
  • 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