Table of Contents
MegaRAID MegaCli
MegaCli is a command line tool provided by MegaRAID to configure/monitor their hardware RAID controllers. Currently all hard drives on Oak are controlled by a MegaRAID SAS 8708EM2 w/ 256Mb RAM.
Installation
MegaCli is available as a RPM for RedHat Linux from LSI MegaRAID 8708EM2. The file name is: 4.00.11_Linux_MegaCLI.zip
For installation on Ubuntu, first we need to install alien
for package format conversion:
$ sudo apt-get install alien
There are two possible ways to perform the actual installation:
1. masker
$ unzip 4.00.11_Linux_MegaCLI.zip Archive: 4.00.11_Linux_MegaCLI.zip extracting: MegaCliLin.zip inflating: 4.00.11_Linux_MegaCLI.txt $ unzip MegaCliLin.zip Archive: MegaCliLin.zip inflating: MegaCli-4.00.11-1.i386.rpm $ alien -g MegaCli-4.00.11-1.i386.rpm .... Directories MegaCli-4.00.11 and MegaCli-4.00.11.orig prepared. $ mv MegaCli-4.00.11/debian MegaCli-4.00.11/DEBIAN $ vi MegaCli-4.00.11/DEBIAN control
Change Orignal “control”
Source: megacli Section: alien Priority: extra Maintainer: MyName Package: megacli Architecture: i386 Depends: ${shlibs:Depends} Description: MegaCli SAS RAID Management Utility. MegaCli is used to manage SAS RAID controllers. . (Converted from a rpm package by alien version 8.79.)
to Modified “control”
Source: megacli Section: alien Priority: extra Maintainer: MyName Package: megacli Architecture: amd64 Depends: Description: MegaCli SAS RAID Management Utility. MegaCli is used to manage SAS RAID controllers. Version: 4.00.11 </code> (including blank line) <code> $ dpkg -b MegaCli-4.00.11 $ sudo dpkg -i MegaCli-4.00.11.deb
2. chkuo
$ sudo alien --to-tgz MegaCli-4.00.11-1.i386.rpm $ tar -xvfz MegaCli-4.00.11.tgz
Usage
A quick reference sheet can be found at http://tools.rapidsoft.de/perc/perc-cheat-sheet.html
Some commonly used commands:
Get Info
To see all adapter info:
sudo /opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL
To see RAID configuration info of adapter 0:
sudo /opt/MegaRAID/MegaCli/MegaCli64 -CfgDsply -a0
To see enclosure info of adapter 0:
sudo /opt/MegaRAID/MegaCli/MegaCli64 -EncInfo -a0
To see virtual drives info of adapter 0:
sudo /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -a0
To see a list of physical drives of adapter 0:
sudo /opt/MegaRAID/MegaCli/MegaCli64 -PDList -a0
To Replace a Hard Drive
WARNING: The following procedure has not been verified yet!!
The example here assumes that the one of the physical hard drive (Enclosure 252, Slot 6, Adapter 0; marked as Physical Disk 2 in Span Reference 0x00) has failed and needs to be replaced.
1. Set the drive offline if it is still online
sudo /opt/MegaRAID/MegaCli/MegaCli64 -PDOffline -PhysDrv [252:6] -a0
2. Mark the drive as missing
sudo /opt/MegaRAID/MegaCli/MegaCli64 -PDMarkMissing -PhysDrv [252:6] -a0
3. Prepare drive for removal
sudo /opt/MegaRAID/MegaCli/MegaCli64 -PDPrpRmv -PhysDrv [252:6] -a0
4. Replace the failed hard drive
5. If the replaced hard drive is listed as Unconfigured(bad)
, change the state
sudo /opt/MegaRAID/MegaCli/MegaCli64 -PDMakeGood -PhysDrv [252:6] -a0
6. Add the physical drive back to the virtual drive
sudo /opt/MegaRAID/MegaCli/MegaCli64 -PdReplaceMissing -PhysDrv [252:6] -Array0 -row2 -a0
7. Start the rebuid
sudo /opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -Start -PhysDrv [252:6] -a0
8. Check the rebuild progress
sudo /opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -PhysDrv [252:6] -a0