megacli - How to Create a RAID6
This tutorial applies to the below MegaRAID card :
LSI MegaRAID SAS 9271-4i
You can follow one of my tutorials on how to install megacli if you do have it already installed.
Initially, we can initially grab information about our MegaRaid card model and the devices connected to our card.
1) Use the below command to get the model of your RAID card :
root@hv2:/opt/MegaRAID/MegaCli# megacli -AdpAllInfo -aALL
With the above command we can also get information about the devices installed in your system :
Device Present
================
Virtual Drives : 1
Degraded : 0
Offline : 0
Physical Devices : 18
Disks : 16
Critical Disks : 1
Failed Disks : 0
I have 18 disks installed and 1 Virtual Drive.
2) Let's get information about our virtual disk and the disks that are part of the virtual disk :
root@hv2:/opt/MegaRAID/MegaCli# megacli -LdPdInfo -aALL
Adapter #0
Number of Virtual Disks: 1
Virtual Drive: 0 (Target Id: 0)
Name :
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
Size : 136.218 GB
Sector Size : 512
Is VD emulated : No
Mirror Data : 136.218 GB
State : Optimal
Strip Size : 256 KB
Number Of Drives : 2
Span Depth : 1
...
Span: 0 - Number of PDs: 2
...
PD: 0 Information
Enclosure Device ID: 17
Slot Number: 0
Drive's position: DiskGroup: 0, Span: 0, Arm: 0
Enclosure position: 1
Device Id: 18
Raw Size: 136.732 GB [0x11177330 Sectors]
...
PD: 1 Information
Enclosure Device ID: 17
Slot Number: 1
Drive's position: DiskGroup: 0, Span: 0, Arm: 1
Enclosure position: 1
Device Id: 19
Raw Size: 136.732 GB [0x11177330 Sectors]
...
Exit Code: 0x00
We now know that the disks in the slot 0 & 1 are part of the logical disk 0 and should not be used in our new RAID.
Let's get the sizes of the disks installed in our system and take note of what slots they are installed
root@hv2:/opt/MegaRAID/MegaCli# megacli -pdlist -aALL | grep -i 'slot\|raw'
Slot Number: 0
Raw Size: 136.732 GB [0x11177330 Sectors]
Slot Number: 1
Raw Size: 136.732 GB [0x11177330 Sectors]
Slot Number: 2
Raw Size: 279.396 GB [0x22ecb25c Sectors]
Slot Number: 3
Raw Size: 279.396 GB [0x22ecb25c Sectors]
Slot Number: 4
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 5
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 6
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 7
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 8
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 9
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 10
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 11
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 12
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 13
Raw Size: 558.792 GB [0x45d964b8 Sectors]
Slot Number: 20
Raw Size: 931.512 GB [0x74706db0 Sectors]
Slot Number: 21
Raw Size: 68.366 GB [0x88bb992 Sectors]
We now know that slots 1&2 are part of the virtual disk 0 and all other disks are not in use. We will create a RAID6 with all 10 x 558Gb disks that are in slots 4 to 13.
Be careful with the next command because if you use the wrong drives you can end up losing data :
root@hv2:~/storage/megacli# megacli -CfgLdAdd -r6'[17:4,17:5,17:6,17:7,17:8,17:9,17:10,17:11,17:12,17:13]' -a0
Adapter 0: Created VD 1
Adapter 0: Configured the Adapter!!
Exit Code: 0x00
We conclude the article with the RAID being presented as /dev/sdc
on our host as seen below :