Create a raid array with MegaCli64
Note: The following is assuming that you have attached new drives to a newly installed LSI raid controller.
The first thing to do is to get a list of all the drives attached to the raid controller. The way the LSI raid controllers identify/label their attached disks is by an ‘Enclosure ID’ and the drive ‘Slot Number’. The following command is an easy way to get a list of all the attached drives:
$ MegaCli64 -pdlist -a0 | grep ^Enclosure\ Device -A1 Enclosure Device ID: 252 Slot Number: 0 — Enclosure Device ID: 252 Slot Number: 1 — Enclosure Device ID: 252 Slot Number: 2 — Enclosure Device ID: 252 Slot Number: 3
Now that we have the list of all the attached drives we can use the following command to create a raid 5 from them.
$ MegaCli64 -cfgldadd r5[252:0,252:1,252:2,252:3] -a0
Let’s breakdown the above command.
- This stands for “Configure Logic Device – Add”
- This declares which raid level to use. In this example we are using raid 5, but it can be r6, etc…
- This is the ‘Enclosure ID:Slot #’ of each drive attached to the raid card
- This stands for ‘Adapter 0′ which represents the first LSI raid card in your system. Unless you have multiple raid cards in your system this value will always be ‘a0′ for all of your MegaCli64 commands.
Initially creating a raid is quite fast, but you can expect days worth of reconfiguring on larger raids if they are altered in any way. After the raid is created we can now see it with the following command:
$ MegaCli64 -ldinfo -l0 -a0 Adapter 0 — Virtual Drive Information: Virtual Drive: 0 (Target Id: 0) Name : RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3 Size : 1.361 TB Sector Size : 512 Is VD emulated : No Parity Size : 464.729 GB State : Optimal Strip Size : 64 KB Number Of Drives : 4 Span Depth : 1 Default Cache Policy: WriteBack, ReadAheadNone, Cached, No Write Cache if Bad BBU Current Cache Policy: WriteBack, ReadAheadNone, Cached, No Write Cache if Bad BBU Default Access Policy: Read/Write Current Access Policy: Read/Write Disk Cache Policy : Disk’s Default Encryption Type : None Is VD Cached: No