Linux adding and sharing a hot spare device in software RAID

Scenario / Question:

How do I add a hot spare to my existing RAID Arrays and also have it shared among the RAID Arrays

Solution / Answer:

Use mdadm to hot add the new drive partition to the RAID Array
Configure mdadm.conf to include “spare-group” setting
Configure mdadm to run in daemon mode and monitor RAID Arrays

Add Spare drive partition to existing Raid Array:

# mdadm /dev/md2 -a /dev/sde1

Configure mdadm.conf to include “spare-group” setting:

Add — “spare-group=global” to the ARRAY line, but make sure that the ARRAY line stays as one line !

#  mdadm --detail --scan --verbose > /etc/mdadm.conf
# 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

Configure mdadm to run in daemon mode and monitor RAID Arrays:

–monitor — Follow/Monitor mode

–scan — Scan config file

-m — Minor number of device that array was created for

nohup — run a command immune to hangups, with output to a non-tty


# nohup mdadm --monitor --scan -m  &

No Comments

Leave a reply