How to create Raid 10 with megacli
Solution 1
Response a Create Raid 10 (not Raid 6)
-
First get the Adapter #
# MegaCli Adpallinfo -aall | grep '^Adapter' Adapter #0
MegaCli or megacli depending distro *nix
In this case Adapter it's
Adapter #0
-
Get Device ID and Slot disk values:
# MegaCli64 -PDlist -aall | grep -e '^Enclosure Device ID:' -e '^Slot Number:' 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
ID in this case for all it's 252
-
According MegaCli command for create RAID 10 it's
MegaCli -CfgSpanAdd -r10 -Array0[E:S,E:S] -Array1[E:S,E:S] -aN
MegaCli -CfgSpanAdd -R10 -Array0[252:0,252:2] -Array1[252:1,252:3] -a0
In this case, create a RAID 10, creating one array for Raid1 with disk 0 and 2, and other array for Raid1 with disks 1 and 3 and N = 0 (-a0)
-
Verify RAID
# megasasctl a0 LSI MegaRAID SAS 9271-4i encl:1 ldrv:1 batt:FAULT, low voltage, charge failed a0d0 1489GiB RAID 10 2x2 optimal a0e252s0 745GiB a0d0 online a0e252s1 745GiB a0d0 online a0e252s2 745GiB a0d0 online a0e252s3 745GiB a0d0 online
Or if
megasasctl
is unavailable:# MegaCli -LDInfo -Lall -aALL Adapter 0 -- Virtual Drive Information: Virtual Disk: 0 (Target Id: 0) Name: RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0 Size:1.454 TB State: Optimal Stripe Size: 256 KB Number Of Drives per span:2 Span Depth:2 Default Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU Current Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU Access Policy: Read/Write Disk Cache Policy: Enabled Encryption Type: None
Solution 2
You didn't understand the man page. E25:S02 - its like variable which should have int values. All you need:
1.Get adapter ID (it's 0 in my example):
root@sto# megacli Adpallinfo -aall | grep '^Adapter'
Adapter #0
2. Get E and S values:
megacli -PDlist -aall | grep -e '^Enclosure Device ID:' -e '^Slot Number:'
You will get something like this:
Enclosure Device ID: 20
Slot Number: 0
Enclosure Device ID: 20
Slot Number: 1
Enclosure Device ID: 20
Slot Number: 2
Enclosure Device ID: 20
Slot Number: 3
Enclosure Device ID: 20
Slot Number: 4
This is you E and S numbers, i.g. 20:0,20:1,20:2,20:3,20:4 So the command to create for example RAID6, will be:
megacli -CfgLdAdd -r6 [20:0,20:1,20:2,20:3,20:4] -a0
Solution 3
I used that (couple months ago to create raid 50):
megacli -CfgSpanAdd -r50 -Array0[252:2,252:3,252:4] Array1[252:5,252:6,252:7] WB RA Direct CachedBadBBU -a0
IBM x3560 and:
Product Name : ServeRAID M5015 SAS/SATA Controller
Serial No : SV14018726
FW Package Build: 12.13.0-0179
Solution 4
I just created a 6-disk RAID-10 with MegaCli, and used the following commands:
(Assuming there is only one controller in these examples, so that -aALL
can be used instead of specifying a particular controller.)
Show the physical drives attached to the controller:
MegaCli -PDList -aALL
Note the "Enclosure Device ID" and "slot number" for the drives from this list as these are the numbers you replace "E" and "S" with, respectively, in the later raid-set creation commands.
Show the existing logical drives (i.e. RAID sets):
MegaCli -LDInfo -Lall -aALL
If you have an existing RAID array which you are going to re-use disks from then you need to remove the existing logical drive which those disks are part of. The logical drive number should be obtained from the previous command. Obviously this will destroy the data on this existing RAID array if you run it:
MegaCli -CfgLdDel -L<n> -aALL
Now you have a bunch of disks which should be in the "Unconfigured(good)" state and hence are available for use in a new logical drive. Lets create a RAID-10 set of 6-disks, which is really a span of 3 RAID-1 pairs of disks:
MegaCli -CfgSpanAdd -r10 -Array0[32:2,32:3] -Array1[32:4,32:5] -Array2[32:6,32:7] -a0
In my case the disks are disks 2 to 7 on enclosure 32. These numbers are obtained from the PDList output you got earlier. If you have 4 disks then it's just two pairs, but the "ArrayN" chunks are always pairs as the underlying RAID-1 pairs in a RAID-10 set.
Your RAID array should now show up to your OS and be available for partitioning etc from there! :)
Related videos on Youtube
Henno
Updated on September 18, 2022Comments
-
Henno almost 2 years
I have OpenFiler storage server.
Without installing Windows and MSM, I want to create raid10 array from disks 2 to 21.
I have already successfully installed MegaCli to OpenFiler but I'm stuck in figuring out the correct command line for creating a raid 10 array.
The documentations says that the syntax for creating a raid 10 is:
MegaCli -CfgSpanAdd -r10 -Array0[E:S,E:S] -Array1[E:S,E:S] -aN
My enclosure ID is 25, so:
[root@linux-h5ut ~]# MegaCli -CfgSpanAdd -r10 -Array0[E25:S02,E25:S21] -Array1[E25:S02,E25:S21] WB Cached NoCachedBadBBU -a0 Invalid input at or near token E
I have googled high and low but there doesn't seem to be any example doing raid10 with megaraid (only the syntax).
Can anyone explain what is wrong?
-
Henno almost 11 yearsBut nevertheless, without E and S letters, megaraid responds with "OSSpecificInitialize: Failed to load libsysfs.so.2.0.2 Please ensure that libsfs is present in the system. The dependent library libsysfs.so.2.0.1 not available. Please contact LSI for distribution of the package Mix of configured and unconfigured drives are not possible.". I guess I have to get this library somehow.
-
Henno almost 11 yearsI had to put /root/opt/lsi/3rdpartylibs/x86_64/libsysfs.so.2.0.2 to the same directory I had put MegaCli (/usr/local/bin)
-
abkrim about 9 yearsAre you sure? Correct it's megacli -CfgSpanAdd for raids 10,50,60 and others with arrays
-
Spooler almost 8 yearsThis is the most correct (if not simply the most direct) answer.
-
bschlueter over 7 yearsThese may be good instructions for RAID 6, but the OP indicated he wanted to build RAID 10.