The LSI MegaRAID Command Tool (CT) is a command line interface (CLI) application for MegaRAID SAS. In the MegaCli useful command examples, You will find examples to use this utility to configure, monitor, and maintain the MegaRAID SAS RAID controllers and the devices connected to them.

Here is a command reference to let you have a quick glance.

MegaCli parameter conventions


Adapter parameter -aN

    The parameter -aN (where N is a number starting with zero or the string ALL) specifies the adapter ID.

Physical drive parameter -PhysDrv [E:S]

    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 Virtual drive management).

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

Battery backup information

    MegaCli -AdpBbuCmd -aALL

Summary info

    MegaCli64 -ShowSummary -aALL

Event info

     MegaCli -AdpEventLog -GetEvents -f logfile -aALL # Dump all events from the adapters event log to a file named logfile


Controller management

Silence active alarm

    MegaCli -AdpSetProp AlarmSilence -aALL

Disable alarm

    MegaCli -AdpSetProp AlarmDsbl -aALL

Enable alarm

    MegaCli -AdpSetProp AlarmEnbl -aALL

Force fw flash

    MegaCli -adpfwflash -f imr_fw.rom -NoVerChk -aAll

Reset to factory default

    MegaCli -adpfacdefset -aALL

Clear controller config to defaults

    MegaCli -CfgClr -aALL

Delete all

    MegaCli -CfgLdDel -LALL -aALL

Adapter diagnostic

    MegaCli -AdpDiag -a0

Virtual drive management

Create RAID 0, 1, 5 drive

    MegaCli -CfgLdAdd -r(0|1|5) [E:S, E:S, ...] -aN

Create RAID 10 drive

    MegaCli -CfgSpanAdd -r10 -Array0[E:S,E:S,E:S,E:S] -aN

Remove drive

    MegaCli -CfgLdDel -Lx -aN

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

Mark bad drive to good

    MegaCli -PDMakeGood -PhysDrv[E:S] -aN
    Changes drive in state Unconfigured-Bad to Unconfigured-Good.


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

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


Patrol Read


Patrol read is a feature which tries to discover disk error before it is too late and data is lost. By default it is done automatically (with a delay of 168 hours between different patrol reads) and will take up to 30% of IO resources.

You can find more detail in megaraid patrol read and consistent check and MeagRAID Patrol Read Detail

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

# MegaCli64 -AdpPR -Info -aALL

To find out the current patrol read rate, execute

# MegaCli64 -AdpGetProp PatrolReadRate -aALL

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

# MegaCli64 -AdpSetProp PatrolReadRate 2 -aALL

To disable automatic patrol read:

# MegaCli64 -AdpPR -Dsbl -aALL

To enable automatic patrol read:

#MegaCli64 -AdpPR -EnblAuto -aALL

To start a manual patrol read scan:

# MegaCli64 -AdpPR -Start -aALL

To stop a patrol read scan:

# MegaCli64 -AdpPR -Stop -aALL

Note: Use the above commands to run patrol read in off-peak times.

Short procedure for drive replacement

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

Comments powered by CComment