Dealing with compound devices
So you want to build a device that is a stripe of two mirrors. Let's say you want md11 to be a mirror, md12 to be a mirror, and md10 to be a stripe across the two mirrors. This is straight forward:
# mdadm -Cv -l1 -n2 /dev/md11 /dev/sdc1 /dev/sdd1
# mdadm -Cv -l1 -n2 /dev/md12 /dev/sde1 /dev/sdf1
# mdadm -Cv -l0 -n2 /dev/md10 /dev/md11 /dev/md12
Only problem is that when you reboot, the system auto-detects md11 and md12, but does not assemble md10.
You need a
/etc/mdadm.conf file which describes your arrays. It is easy to generate:
# mdadm --detail --scan > /etc/mdadm.conf
Now you have to edit
/etc/mdadm.conf to do three things:
- remove the indented devices lines which follow the ARRAY definitions;
- add a DEVICE line at the top of the file; and
- ensure that the order, top to bottom, doesn't require the use of devices which are not already defined.
My un-edited file looks like this:
ARRAY /dev/md10 level=raid0 num-devices=2 UUID=31d56ab5:ae6e27cf:ab83fe73:cf9831ba
devices=/dev/md11,/dev/md12
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=0e61b88d:a794151e:79182b5e:bf1fd232
devices=/dev/sdb2,/dev/sda2
ARRAY /dev/md3 level=raid1 num-devices=2 UUID=a5957435:75fc4785:3473a7ed:9e120096
devices=/dev/sdb3,/dev/sda3
ARRAY /dev/md11 level=raid1 num-devices=2 UUID=5e8f96ed:e22d87e1:cff749a2:29f06896
devices=/dev/sdc1,/dev/sdd1
ARRAY /dev/md12 level=raid1 num-devices=2 UUID=31f90d33:204cefde:fd3c776d:a4744ca3
devices=/dev/sde1,/dev/sdf1
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=fd972ff8:2110cc30:f06bc3ad:6d9c8011
devices=/dev/sdb1,/dev/sda1
With the editing, it looks like this:
DEVICE /dev/sda1 /dev/sda2 /dev/sda3 /dev/sdb1 /dev/sdb2 /dev/sdb3 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/md11 /dev/md12
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=0e61b88d:a794151e:79182b5e:bf1fd232
ARRAY /dev/md3 level=raid1 num-devices=2 UUID=a5957435:75fc4785:3473a7ed:9e120096
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=fd972ff8:2110cc30:f06bc3ad:6d9c8011
ARRAY /dev/md11 level=raid1 num-devices=2 UUID=5e8f96ed:e22d87e1:cff749a2:29f06896
ARRAY /dev/md12 level=raid1 num-devices=2 UUID=31f90d33:204cefde:fd3c776d:a4744ca3
ARRAY /dev/md10 level=raid0 num-devices=2 UUID=31d56ab5:ae6e27cf:ab83fe73:cf9831ba
Note that this example includes three other arrays (md1, md2, and md3) which are not required for the raid-10 device.
(
Primary Source)