How to replace a failed hard disk from a raid
In order to replace a failed hard disk from a raid, do the following:
dd if=/dev/sd<OK> of=/dev/sd<NEW> count=10
sfdisk --re-read
sync
MAKEDEV sd<NEW>
mkswap /dev/sd<NEW>2
mdadm -a /dev/md1 /dev/sd<NEW>1
mdadm -a /dev/md3 /dev/sd<NEW>3
mdadm -a /dev/md4 /dev/sd<NEW>4
where <OK> is the device of the hard disk which is OK, for example a, so the device would be /dev/sda
and <NEW> is the device of the hard disk which you newly mounted in, for example b, so the device would be /dev/sdb
Rebuild starts automatically. You can follow the progress with:
cat /proc/mdstat