Get current raid status

cat /proc/mdstat

Replace a degraded disk in an array

First work out which disk it is in the array (e.g. /dev/sda), then use lshw to get the serial number of the disk.

Now mark all the partitions on the disk as degraded

mdadm --manage /dev/md0 --fail /dev/sda1
mdadm --manage /dev/md0 --remove /dev/sda1

Now power down the machine and replace the failed drive using the serial number from lshw to identify it if necessary

Once the new drive is in, power the machine up, recreate the partition setup on it in the same way as the old drive was and then re-add the drive to the raid array with

mdadm --manage /dev/md0 --add /dev/sda1

You can then cat /proc/mdstat to see the drive start rebuilding.

Speeding up the raid rebuild

To speed up the rebuild if the machine isn’t otherwise too busy you can adjust the values of

/proc/sys/dev/raid/speed_limit_min
/proc/sys/dev/raid/speed_limit_max

Try setting the min to 50000 and the max to 200000

You can also turn bitmaps on to speed up the rebuild with

mdadm --grow --bitmap=internal /dev/md0

then turn them off once the rebuild is complete with

mdadm --grow --bitmap=none /dev/md0