Linux – Reusing older raid discs

linuxmdadmraidsoftware-raid

I have a software RAID5 array (Linux md) on 4 disks; the OS is OpenSUSE 12.3.

Recently I replaced a disc with a larger one (fail disc, remove it, add new disc). The capacity of the array has not yet increased as I didn't replace all discs. Now the new one seems to be bad and I want to replace it with the old one. Can I simply remove the new one (fail, remove) and replace it with the unchanged old one or should I format the old one before adding it to the array? The array has a bitmap.

What would happen if I simply shut down the machine and replaced the discs without using mdadm?

Best Answer

If the bitmap has not changed when the old disk was replaced by the new one, it should work to mark the disk as failed and remove it from the array.

mdadm -f /dev/md0 /dev/sda1
mdadm -r /dev/md0 /dev/sda1

Then replace the disk and add the old one to the array:

mdadm --add /dev/md0 /dev/sde1

I think that shutting down the machine and replacing the disks would also work, but the mdadm method has the advantage that the disks can be hot-plugged if supported by the machine.

Related Question