Remove drive from soft RAID

You've got a three-way mirror there: each drive has a complete copy of all data. Assuming the drive you want to remove is /dev/sdc, and you want to remove it from all three arrays, you'd perform the following steps for /dev/sdc1, /dev/sdc2, and /dev/sdc4.

Step 1: Remove the drive from the array. You can't remove an active device from an array, so you need to mark it as failed first.

mdadm /dev/md1 --fail /dev/sdc1
mdadm /dev/md1 --remove /dev/sdc1

Step 2: Erase the RAID metadata so the kernel won't try to re-add it:

wipefs -a /dev/sdc1

Step 3: Shrink the array so it's only a two-way mirror, not a three-way mirror with a missing drive:

mdadm --grow /dev/md1 --raid-devices=2

You may need to remove the write-intent bitmap from /dev/md4 before shrinking it (the manual isn't clear on this), in which case you'd do so just before step 3 with mdadm --grow /dev/md4 --bitmap=none, then put it back afterwards with mdadm --grow /dev/md4 --bitmap=internal.

Tags:

Raid

Raid1