How to use the MegaCLI Utility with your RAID Controller on your PowerEdge Server in Linux

Article Summary: This article provides information on how to use the MegaCLI utility with your RAID controller on your PowerEdge server in Linux.


Table of Contents:

1. Installation
2. Display general information
3. Generate controller log
4. Create a virtual disk
5. Physical disk management
6. Display additional information


1. Installation of the MegaCLI RPM

  • Ensure you are logged in as ‘root
  • Download MegaCLI to your server :
    • # mkdir /root/megacli
    • # cd /root/megacli
    • # wget http://www.lsi.com/downloads/Public/Nytro/downloads/Nytro%20XM/Management%20Software%20and%20Tools/NMR%201.5/CSA1.5-MegaCli_REL80571.zip
  • Unzip and install MegaCLI :
  • # unzip 8.07.07_MegaCLI.zip
  • # cd linux
  • # rpm -Uvh MegaCli-8.07.07-1.noarch.rpm
  • # alias MegaCli=”/opt/MegaRAID/MegaCli/MegaCli64″

Back to Top


2. Display general information

  • Display enclosure information :
    • # MegaCli -EncInfo -aALL | less
  • Display battery information :
  • # MegaCli -AdpBbuCmd -aALL | less
  • # MegaCli -CfgDsplay -aALL | less
  • # MegaCli -AdpAllInfo -aALL | less
  • # MegaCli -LDInfo -Lall -aALL | less
  • # MegaCli -PDList -aALL | less
  • Display overview of controller(s), virtual disk(s), and physical disk(s) :
  • Display in depth controller information :
  • Display virtual disk information :
  • Display physical disk information :

Back to Top


3. ;Generate a controller log

  • # MegaCli -AdpEventLog -GetEvents -f controller_log.txt -aALL

Back to Top


4. Create a virtual disk

  • Create a RAID 1
    • Example : Create a RAID 1 using disks 0 and 1 on adapter 0 on enclosure 32
    • # MegaCli -CfgLdAdd -r1 [32:0, 32:1] -a0
  • Create a RAID 5
  • Example : Create a RAID 5 using disks 0, 1, and 2 on adapter 0 on enclosure 32
  • # MegaCli -CfgLdAdd -r5 [32:0, 32:1, 32:2] a0
  • Example : Create a RAID 6 using disks 0, 1, 2, and 3 on adapter 0 on enclosure 32
  • # MegaCli -CfgLdAdd -r6 [0320, 32:1, 32:2, 32:3] a0
  • Example : Create a RAID 10 using disks 0, 1, 2, and 3 on adapter 0 on enclosure 32
  • # MegaCli -CfgSpanAdd -r10 -Array0[32:0, 32:1] -Array1[32:2, 32:3] -a0
  • Create a RAID 6
  • Create a RAID 10

Back to Top


5. Physical disk management

  • Offline a disk
    • Example : Set disk 0 offline on adapter 0 on enclosure 32
    • # MegaCli -PDOffline -PhysDrv [32:0] -a0
  • Online a disk
  • Example : Set disk 0 online on adapter 0 on enclosure 32
  • # MegaCli -PDOnline -PhysDrv [32:0] -a0
  • # MegaCli -PDRbld -ShowProg -PhysDrv [32:0] -a0
  • Example : Set disk 0 as a global hot spare on adapter 0 on enclosure 32
  • # MegaCli -PDHSP -Set -PhysDrv [32:0] -a0
  • Example : Set disk 0 on virtual disk 0 as a dedicated hot spare on adapter 0 on enclosure 32
  • # MegaCli -PDHSP -Set -Dedicated -Array0 -PhysDrv [32:0] -a0
  • Example : Remove disk 0 as hot spare on adapter 0 on enclosure 32
  • # MegaCli -PDHSP -Rmv -PhysDrv [32:0] -a0
  • Rebuild a disk< >Example : Set disk 0 to rebuild on adapter 0 on enclosure 32# MegaCli -PDRbld -Start -PhysDrv [32:0] -a0Example : Display status of rebuild on disk 0 on adapter 0 on enclosure 32Configure global hot spare
  • Configure dedicated hot spare
  • Remove hot spare

Back to Top


6. Display additional information

  • Enable write back cache on all virtual disks on adapter 0
    • # MegaCli -LDSetProp WB -LALL -a0
  • Disable write back cache on all virtual disks on adapter 0
  • # MegaCli -LDSetProp NoCachedBadBBU -LALL -a0
  • # MegaCli -AdpPR -Start -a0
  • # MegaCli -AdpPR -Stop -a0
  • Start a patrol read on adapter 0
  • Stop a patrol read on adapter 0

发表评论