mdadm hot spare question

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

DolphinsDan

Member
Sep 17, 2013
90
6
8
I'm trying to make a server we are going to deploy in our datacenter. I want to have two RAID 1 mdadm arrays. I then want to have two extra SSDs that will be there as global "hot-spare" more or less. So they can be used in either array if a drive fails.

How do I do this with mdadm? Is it possible?

The reason for two hot spares BTW is because I want the drives to servcie both arrays.
 

sboesch

Active Member
Aug 3, 2012
467
95
28
Columbus, OH
To add to an existing array,
Code:
mdadm /dev/md2 -a /dev/sde1
Then configure mdadm.conf to include a spare group:

Code:
 vi /etc/mdadm.conf # location of mdadm.conf maybe different for your distro

DEVICE partitions
MAILADDR root
ARRAY /dev/md2 super-minor=2
ARRAY /dev/md1 super-minor=1
ARRAY /dev/md3 level=raid1 num-devices=2 spare-group=global
UUID=20cc61f3:eab7c2b7:f8690125:58bbeb6b
   devices=/dev/sdc1,/dev/sdd1
ARRAY /dev/md2 level=raid1 num-devices=2 spares=1 spare-group=global
UUID=e7cb8287:235a7481:3cd777bf:3551e58b
   devices=/dev/sda2,/dev/sdb2,/dev/sde1
ARRAY /dev/md1 level=raid1 num-devices=2
UUID=2a4d5991:8109b8fb:3cf4699b:12eb3a71
   devices=/dev/sda1,/dev/sdb1
 

MiniKnight

Well-Known Member
Mar 30, 2012
3,073
974
113
NYC
If you're deploying a new one:
Code:
mdadm --create /dev/md0 --level=1 --raid-devices=2 --spare-devices=2 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1