0

How do I configure a new mdadm software RAID-10 to use a specific order for its drive mirroring?

Say I have 4 hard drives: A, B, C, and D.

For my own reliability and performance reasons, I want drive A to be a mirror of drive C, and drive B to be a mirror of drive D. Then each mirror striped, like this

 |----- RAID-0 ----- |
  RAID-1      RAID-1
|---------| |---------|
| drive A | | drive B |
| drive C | | drive D |
|---------| |---------|

I don't see a way to configure this. Not sure about the drive order this command produces:

mdadm --create /dev/md0 --level=10 --raid-devices=4 /dev/sd[a-d]1

Is there a way to manually order the drives in a mdadm array?

If not, is there a way to check the order after the array is created so I could physically move the drives into the configuration I want? (I think I can create the array members using /dev/disk/by-id/ata* so I can physically move them without worrying about /dev/sd* re-ordering.)

Bonus question. I also will want a hot spare, drive E, to be available to either mirror set.

Crash Override
  • 601
  • 1
  • 10
  • 21

1 Answers1

0

Think I figured out my own answer. Set up two RAID-1s first, then RAID-0 them together.

Created two RAID-1 volumes

sudo mdadm --create /dev/md/md2a --level=1 --raid-devices=2 /dev/disk/by-id/ata-WDC_serial_number_of_drive_A-part1 /dev/disk/by-id/ata-WDC_serial_number_of_drive_C-part1
sudo mdadm --create /dev/md/md2b --level=1 --raid-devices=2 /dev/disk/by-id/ata-WDC_serial_number_of_drive_B-part1 /dev/disk/by-id/ata-WDC_serial_number_of_drive_D-part1

(I used drive ID's instead of /dev/sda,/dev/sdb,... to ensure an exact match of the drive I want)

Then, created RAID-0 with the two RAID-1 arrays

sudo mdadm --create /dev/md/md2 --level=0 --raid-devices=2 /dev/md/md2a /dev/md/md2b

I will update this with results in a couple days, after the arrays sync and after I add a hot-spare drive, and I have time to test.

Crash Override
  • 601
  • 1
  • 10
  • 21
  • 1
    Why are you not just creating it with `--level=10` and specifying your four devices? This smells like needless complexity that will come back to bite you later. Probably as soon as you reboot. – Michael Hampton Jun 02 '21 at 20:16
  • Thanks for your reply. Works fine after reboot. Wanted this setup for my own reliability & performance reasons. Drives **A** and **B** are in one external enclosure, and drives **C** and **D** are in another (each have separate power supplies & fans). If one enclosure dies, I want the RAID-10 to stay online. What I did not want was `--level=10` picking its own setup where mirrored drives would be within the same enclosure. – Crash Override Jun 02 '21 at 22:22