0

I have a software RAID-5 made up of 3 drives, call them A,B,C. I would like to replace the old C drive with a newer and larger-capacity one to eventually expand the array. This is on an Ubuntu 16.04 system running mdadm to manage the drives.

Online searches recommend taking drive C offline by setting failing mode, remove it from the array, add a new drive D and let the array resync. I worry that while the resync process is happening (on the order of a day for a 1.5 TB drive) the array is fragile and could be lost if drives A or B fail.

Is there a way to instead, add a new drive D to the array and let it 'mirror/sync' the contents of drive C first and then just fail/remove drive C in such a way that the array does not need to resync?

Note: I edited some of the terminology to clarify the issue thanks to the comments

  • You are asking the wrong question. If you called your data, stop using RAID5 - it is not considered robust after 2TB total storage. Maybe look at moving to RAID10. – davidgo May 22 '18 at 10:32
  • Your terminology is wrong. You are not failing a drive, you are making it offline. Also, you do not mention OS or RAID software. Those will be limiting factors. – Keltari May 22 '18 at 19:18
0

This seems to be a duplicate of https://unix.stackexchange.com/questions/74924/how-to-safely-replace-a-not-yet-failed-disk-in-a-linux-raid5-array

According to the accepted answer there provided you have at least mdadm 3.3 and kernel 3.2 (afaict ubuntu 16.04 does) you first add the device as a spare, then tell mdadm you want to replace the old drive with the new one.

# mdadm /dev/md0 --add /dev/sdc1
# mdadm /dev/md0 --replace /dev/sdd1 --with /dev/sdc1

Where sdc1 is the new drive and sdd1 is the old drive.

  • Yes!!! This is exactly what I was looking for. Thank you. – Rodrigo May 24 '18 at 17:23
0

Depends on exactly what you're using. All the potential options I can think of require you to be able to plug the new drive in while all the old ones are connected, but in general you may be able to do any of the following:

  • Reshape the array to include the new drive, and then reshape it again to remove the old drive. Pretty much any sane software RAID implementation should be able to do this, most of them online too, though it's horribly inefficient.
  • Add the new drive to the array as a hot-spare, fail the old one, and then remove the old one from the array (as it should now be treated by the array as a hot-spare). This will usually be supported by most software RAID implementations, and is much more efficient than the first option (it only rebuilds parity once, not twice).
  • If you've got a really nice software RAID implementation, or are using BTRFS (or possibly ZFS, I don't know if they support it or not), you can actually replace the drive without even having to rebuild the array. For BTRFS, this would be through the btrfs device replace command, which essentially does the on-line equivalent of cloning the old device.
  • Thanks for this pointer. I'll look at BTRFS and ZFZ. I am using mdadm. – Rodrigo May 23 '18 at 16:45
  • @Rodrigo Just an advance warning regarding BTRFS, it uses terminology like RAID does, but there are some rather important differences between BTRFS behavior and classic RAID (RIAD1 for example is currently only 2 copies on BTRFS, no matter how many devices you have in the volume). – Austin Hemmelgarn May 24 '18 at 19:10
  • Thanks @Austin. I looked into BTRFS and RAID-5 looks to be implemented but not yet mature. Instead, I learned that mdadm can actually --replace a disk. That is exactly what I was looking for and will go that route. – Rodrigo May 25 '18 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.