How to Set Up Hardware RAID Using MegaCLI

November 20, 2019


MegaCLI is a tool used as a command-line interface to communicate with the LSI family of RAID controllers. It manages and reports on MegaRAID SAS cards.

In this article, you will learn how to install MegaCLI and set up a hardware RAID.

article on how to configure raid using megacli


  • A Linux system (installation instructions apply to CentOS/RHEL and Ubuntu based distros)
  • Access to the command-line/terminal window
  • A MegaRAID hardware controller
  • An unzip utility tool

Install and Set Up MegaCLI

MegaCLI supports MS Windows, FreeBSD, Solaris and all major Linux distributions. This article provides instructions on installing MegaCLI on CentOS 8 and Ubuntu.

Step 1: Verify Your Hardware RAID Controller

To use MegaCLI, you need a MegaRAID SAS controller. If you are unsure which RAID controller you are using, start by verifying it.

Use the lspci command to verify the RAID controller on your system.

lspci | grep -i raid

The output will display your RAID controller. See the example outputs below:

output 1
LSI Logic / Symbios Logic MegaRAID SAS 1078 (rev 04)
output 2
01:00.0 RAID bus controller: Adaptec AAC-RAID (rev 09)
output 3
02:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2208 [Thunderbolt] (rev 05)

If you do not receive any output, like in the image below, it is an indication that the system is not identifying any RAID controller. Make sure that the controller is set up correctly.

no raid controller verified

If the output indicates that you indeed have a MegaRAID SAS controller, move on to installing MegaCLI.

Step 2: Download MegaCLI

Download MegaCLI by navigating to the Support Documents and Downloads section of the Broadcom website. The MegaCLI install file is under the Management Software and Tools list as shown below.

webpage to download megacli

Step 3: Extract the MegaCLI Package

Next, move into the Downloads folder.

cd Downloads

3. Extract the file.

unzippinf the megacli install archive

Step 4: Install MegaCLI

Option 1: Install MegaCLI on CentOS 8

Move into the Downloads/Linux folder by typing:

cd Downloads/Linux

Once in the Linux folder, run the following command to install MegaCLI on CentOS 8:

yum localinstall MegaCli-8.07.14-1.noarch.rpm
command to install megacli on centos 8

Option 2: Install MegaCLI on Ubuntu

LSI distributes MegaCLI as an rpm package. Ubuntu does not support rpm packages, but the MegaCLI install package can be converted for use with Ubuntu by using Alien. 

Start by moving into the Downloads/Linux folder.

cd Downloads/Linux

Convert the MegaCLI rpm package with Alien:

alien -k --scripts MegaCli-8.07.14-1.noarch.rpm

Install the newly created .deb file with the dpkg command:

dpkg -i megacli_8.07.08-1_all.deb
example of installing the deb file with dpkg

Note: If you don’t have Alien on your Ubuntu system, run the following command to install it:

sudo apt-get install alien

Step 5: Create an Alias

Finally, create an alias for easier reference in the future:

alias megacli='/opt/MegaRAID/MegaCli/MegaCli64'

Now that you have MegaCLI set up, examine the list of common commands you will be using to manage RAID disks.

Hardware RAID Setup with MegaCLI

MegaCLI supports configuring all widely used hardware RAID levels:

  1. RAID 0
  2. RAID 1
  3. RAID 5
  4. RAID 10
  5. RAID 1 with CacheCade

Note: The three basic techniques of RAID levels are disk striping, disk mirroring, and parity. Depending on how these techniques are implemented, different RAID types and levels can be established. To learn more, check out our article on RAID levels and types.

Clear Configuration

Before you configure any disks, make sure to delete any previous configuration you may have on them. The following commands will allow you to do so:

megacli -CacheCade -remove -LALL -aALL
megacli -CfgCacheCadeDel -LALL -aALL
megacli -CfgLdDel -LAll -aAll
megacli -CfgClr -force -aAll

Configure RAID 0

To configure disks as RAID 0 which will strip data across two or more disks, use the commands:

megacli -CfgEachDskRaid0 -a0
megacli -LDInfo -LAll -a0
hardware raid 0 configuration

Configure RAID 1

To configure a RAID 1 setup of two disks from slot 0 to 1, type:

megacli -CfgLdAdd -r1 [252:0,252:1] -a0
megacli -LDInfo -LAll -a0
configuring hardware raid 1 with megacli

Configure RAID 5

To configure a RAID 5 device made up of disks from slots 0 to 5 use the command:

megacli -CfgLdAdd -r5 [252:0,252:1,252:2,252:3,252:4,252:5] -a0
megacli -LDInfo -LAll -a0
hardware raid 5 setup

Configure RAID 10

To configure RAID 10 consisting of 8 disks placed in slots 0 to 7, type:

megacli -CfgSpanAdd -r10 -Array0[252:0,252:1] -Array1[252:2,252:3] -Array2[252:4,252:5] -Array2[252:6,252:7] -a0
megacli -LDInfo -LAll -a0
raid 10 configuration with megacli

Configure RAID with CacheCade

You can also create additional CacheCade in RAID 1 on SSD disks.

For example, if you have 6 disks in slots 0 through 5. You can create a RAID 5 device consisting of four disks and an additional CacheCade on the remaining two disks.

1. Configure RAID 5 on disks 0 through 4 with the command:

megacli -CfgLdAdd -r5 [252:0,252:1,252:2,252:3,252:4] -a0

2. Next, create CacheCade configuration using SSDs for slots 5 and 6:

megacli -CfgCacheCadeAdd -r1 -Physdrv[252:5,252:6] WB -assign -L0 -a0

Check Adapter, Device Status and Configuration

There are several commands you can use to check the status of your adapters and RAID devices.

To see details of all adapters use:

megacli -AdpAllInfo -aAll

To see status and configuration of all logical drives:

megacli -LDInfo -LAll -aAll

To show information of all physical disks use:

megacli -PDList –aAll

For enclosure information type:

megacli -EncInfo -aALL


After reading this article you should now be more informed on how to install and use MegaCLI to effectively manage your RAID devices and configurations.

Was this article helpful?
Dejan Tucakov
Dejan is the Head of Content at phoenixNAP with over 8 years of experience in Web publishing and technical writing. Prior to joining PNAP, he was Chief Editor of several websites striving to advocate for emerging technologies. He is dedicated to simplifying complex notions and providing meaningful insight into data center and cloud technology.
Next you should read
Raid Levels and Types: Advantages and Disadvantages of 0,1,5,10
July 23, 2019

RAID (redundant array of independent disks) is a setup consisting of multiple disks for data storage. They...
Read more
7 Best Website Speed and Performance Testing Tools
June 3, 2019

There are programs that answer two of the most common questions web administrators and SEO's keep asking when...
Read more
7 Ways to Reduce Server Response Time
December 20, 2023

Reducing server response time to the bare minimum is one of the primary goals of website owners and SEO...
Read more
NVMe vs. SATA: Storage Comparison & Differences
April 11, 2024

This article compares NVMe and SATA SSD features and explores different use cases to help you develop...
Read more