There are 2 ways to RAID10 with mdadm. With 1 layer of mdadm or with 2 layers of mdadm. I would prefer the 1 layer of mdadm (meaning using mdadm level 10 algorithm) rather than the 2 layer of mdadm (mds of raid1 raided to an md of raid0), because less layers is faster:
1 LAYER USING MDADM –level 10:
If you constructed your mdadm raid out of 1 layer of MD like this:
mdadm --create /dev/md2 --level=10 -raid-devices=4 /dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3
You know that the RAID10 will look either like this
sda3 raid1 with sdb3
sdc3 raid1 with sdd3
and those are raid0ed
or is it
sda3 raid1 with sdd3
sdc3 raid1 with sdb3
and those are raid0ed
One way to find out:
# RAID10 pairs # dp = data partition (sda3, sdb3, etc... so you put 3) # dl = drive letters (we have a b c d, so its "a b c d") # --- start of variables --- # dp=3 dl="a b c d" # --- end of variables --- # for i in ${dl}; do echo -n "sd${i}${dp}: " dd if=/dev/sd${i}${dp} bs=1M skip=10 count=50 2> /dev/null | md5sum - | awk '{print $1}' done | sort -k2
# output is: sda3: aaaaa123 sdb3: aaaaa123 sdc3: cccc1212 sdd3: cccc1212
So the pairs are like this
# added number manually to represent pair# sda3: aaaaa123 1 sdb3: aaaaa123 1 sdc3: cccc1212 2 sdd3: cccc1212 2
pair 1 is sda3 and sdb3
pair 2 is sdc3 and sdd3
So we know that sda3 and sdb3 are raid1 pairs, and we know that sdc3 and sdd3 are raid1 pairs.
How does this benefit me?
Ex: Lets pretend we had 3 disk fail.. sdb, sdc and sdd… Well knowing what we know we know that we can clone/recover disk sdc or sdd (probably which ever disk is better off, we will clone that one). Then we can get our data, we wont need to clone all 3 drives. Because the system would be able to run with 2 missing drives.
2 LAYER USING MDADM
So lets say you made a raid10 like this:
mdadm --create /dev/md10 --level=1 -raid-devices=2 /dev/sda3 /dev/sdb3 mdadm --create /dev/md11 --level=1 -raid-devices=2 /dev/sdc3 /dev/sdd3
Then you raid0ed it like this:
mdadm --create /dev/md20 --level=0 -raid-devices=2 /dev/md10 /dev/md11
Then of course you would use md20 to mount
start off with what you mount in this case it would be md20. And get its info with mdadm -D
mdadm -D /dev/md20
It will show us its members as md10 and md11. We then would use
mdadm -D /dev/md10 mdadm -D /dev/md11
Now we know that the drives in md10 are raid1ed together and the drives in md11 are in a different raid1.