MegaCli introduced by LSI is a command line administration of LSI MegaRaid controllers .
With megacli we can create physical raids, gather info about raids and monitor raids.
MegaCLI provided by LSI is the most cryptic command line utility in existence.
Dell PowerEdge servers uses the LSI MegaRAID controllers

Installation

Download and Install MegaCli and other supportive tools
Inside the zip file you’ll find an RPM archive which contains the MegaCli and MegaCli64 binaries


wget http://162.243.29.98/MegaCli-8.07.14-1.noarch.rpm
or
http://162.243.29.98/8-07-14_MegaCLI.zip

Command to install MegaCli using rpm

rpm -ivh MegaCli-8.07.14-1.noarch.rpm

Command location (will be installed to /opt/MegaRAID/MegaCli)

    /opt/MegaRAID/MegaCli/MegaCli64


Make an alias for easier use

    alias megacli=’/opt/MegaRAID/MegaCli/MegaCli64′

Extra tools

MegaCli is not providing all the information we need like mapping to linux devices and raid level (readable), so we are going
to use some extra tools.

yum install sg3_utils

Useful Commands for Megacli

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

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

To see information about the patrol read state and the delay between patrol read runs

    megacli -AdpPR -Info -aALL

To find out the current patrol read rate

    megacli -AdpGetProp PatrolReadRate -aALL

To reduce patrol read resource usage to 2% in order to minimize the performance impact

    megacli -AdpSetProp PatrolReadRate 2 -aALL

To disable automatic patrol read

    megacli -AdpPR -Dsbl -aALL

To start a manual patrol read scan

    megacli -AdpPR -Start -aALL

To stop a patrol read scan

    megacli -AdpPR -Stop -aALL

If your system is not connected to a UPS, you should disable the physical disk cache in order to prevent data loss.

    megacli -LDGetProp EnDskCache -LAll -aALL

To enable it (only do this if you have a UPS and redundant power supplies)

    megacli -LDGetProp DisDskCache -LAll -aALL

Detail about disks

    megacli -ShowSummary -aALL

To Check patrol read warnings

    megacli -AdpEventLog -GetSinceReboot -warning -fatal -a0

Command to check RAID type RAID0 or RAID1 or RAID10

[root@testsrc]

# megacli -LDInfo -L0 -a0 |grep -i raid
Name :Raid10
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0

[root@testsrc]