2

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):

  1. fail the drive in all mdX devices
  2. remove the drive from arrays
  3. physically replace the drive
  4. rescan sata if needed with echo "0 0 0" >/sys/class/scsi_host/host<n>/scan
  5. copy partition table with sfdisk, e.g. sfdisk -d /dev/sda| sed 's/sda/sdc/'| sfdisk /dev/sdc
  6. add drive to corresponding mdX devices

1 Answer 1

0

No.

RAID 5 allows for a single disk failure before you have data loss. If it is still rebuilding, you do not have all 4 disks being part of the RAID yet. Removing a disk before it is synced will cause complete data loss.

If you are still just deploying the server it would probably be fastest and safest to start over with good disks.

Month long rebuild times are the main reason people don't recommend RAID 5 anymore for large disks - the chance of a second disk failing during that resync time is just too high.

3
  • Well, I figured I have nothing to lose and followed through with the procedure... strangely enough, it went without a hitch. Did fail-remove combo on all four disks, unplugged it, arrays became "clean, degraded", put in the new disk - it was recognized without any additional steps - copied partitions and added them to their respective arrays. Rebuild is almost complete after an hour. I find it strange though, will try to rationalize this outcome.
    – XNRL
    Mar 30, 2016 at 11:58
  • @XNRL you haven't actually succeeded until you have verified none of your files have been corrupted. You likely now have at least some data corruption.
    – Grant
    Mar 30, 2016 at 12:01
  • You're probably right. I was lucky that the unsynced partition was used for /home and there wasn't much on it. I'll check thoroughly tomorrow if there was any data corruption.
    – XNRL
    Mar 30, 2016 at 19:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .