Mdadm

From Useful Things
Jump to: navigation, search

Remove a drive from an active array

mdadm --manage /dev/md0 --fail /dev/sdX # set the drive as failed
mdadm --manage /dev/md0 --remove /dev/sdX # remove the drive from the array

Add a drive to an active and degraded array

mdadm --manage /dev/md0 --add /dev/sdX # add the drive

Check array status

Both cat /proc/mdstat and mdadm --detail /dev/md0 have detailed output about configured arrays.

Possible issues

Array refuses to rebuild when in a degraded state and a new drive is added

The array might be frozen:

root@galaxy:~# cat /sys/block/md0/md/sync_action
frozen

So give it a nudge:

root@galaxy:~# echo idle > /sys/block/md0/md/sync_action
root@galaxy:~# cat /sys/block/md0/md/sync_action
recover