mdadm – How to Display and Define Mirror/Stripping Pairs

mdmdadmraidraid10software-raid

I want to make a standard linux software Raid10 over 4 HDD. The server has 4HDDs, 2 pairs from different vendors in order to avoid batch problems.

I want to have the mirror over two different Vendors, and then the Stripe over the mirror pairs. I could do that by manually creating Raid1/0, but mdadm supports Raid level 10. I just cant figure out how the Raid10 is then handled and how the data is distributed.

mdadm --detail /dev/md10
/dev/md10:
        Version : 1.2
  Creation Time : Wed May 28 11:06:23 2014
     Raid Level : raid10
     Array Size : 1953260544 (1862.77 GiB 2000.14 GB)
  Used Dev Size : 976630272 (931.39 GiB 1000.07 GB)
   Raid Devices : 4
  Total Devices : 4
    Persistence : Superblock is persistent

    Update Time : Wed May 28 11:06:23 2014
          State : clean, resyncing (PENDING) 
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0

         Layout : near=2
     Chunk Size : 512K

           Name : phost:10  (local to host phost)
           UUID : a3de0ad5:9e694ee1:addc6786:c4449e40
         Events : 0

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       81        1      active sync   /dev/sdf1
       2       8       97        2      active sync   /dev/sdg1
       3       8      113        3      active sync   /dev/sdh1

does not really give any information about that.

How it should be:

Raid 1 / Mirror over /dev/sda1 /dev/sdf1 and /dev/sdg1 /dev/sdh1

Raid 0 over the two Raid 1 pairs

Is it possible to do that with the built in "level=10", how can I see what pairs are mirrored?

Thanks a lot for you help

Best Answer

I can't find a anything that says if you create a RAID10 array of 4 devices then the mirrors will be (ab) (cd) or whatever. If you want to guarantee the placement then you can create a nested raid by first of all creating two mirrors then creating a stripe with them.

Create the mirrors

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdf1
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdg1 /dev/sdh1

Then stripe them

mdadm --create /dev/md10 --level=0 --raid-devices=2 /dev/md0 /dev/md1

So now /dev/md10 is a stripe of two mirrors and you know the location of each type of disk.