I'm preparing a server with 4 disks assembled into software RAID5 during Debian 8 installation. Shortly after the system was configured, SMART detected an Offline Uncorrectable Sector error, so I thought it'd be a good idea to replace the probably-failing disk while the server is still on the testbench.
However, one of the md devices is still rebuilding, estimating completion time a month or so away.
The main question is: is it safe/correct to manually fail and remove a disk from an array while it's still syncing?
There are 4 x 500 GB SATA each divided into 4 partitions and assembled into 4 RAID5 devices md[0-3].
The whole procedure looks, I assume, like this (I'd rather do a disk hot-swap out of curiosity and in case I'll have to do this on a live server someday):
- fail the drive in all mdX devices
- remove the drive from arrays
- physically replace the drive
- rescan sata if needed with
echo "0 0 0" >/sys/class/scsi_host/host<n>/scan
- copy partition table with sfdisk, e.g.
sfdisk -d /dev/sda| sed 's/sda/sdc/'| sfdisk /dev/sdc
- add drive to corresponding mdX devices