I have a 3 years old server with two same disks. I'm planning to replace both before they fails. Can I add two more new disks to the raid and (after it has been rebuild) eventually remove the two old ones? Or which is the best way to do this? Thank you
2 Answers
So assuming you are using mdadm you can do exactly what you suggest The only caveat is that the raid monitoring utility will generally only handle one disk at a time and normally when you have marked one as failed. Further you just need to ensure that it has completed copying the data before removing the old disks from the raid array otherwise you'll end up removing the "live" disks with nothing on the new ones and corrupt your array.
Commands that you will find useful for doing this are as follows:
To add a new disk to the array:
# mdadm /dev/<mddevice> --add /dev/<newdisk>
To see the status and recovery process:
cat /proc/mdstat
To mark the old disk as 'failed' and remove it from the array:
# mdadm /dev/<mddevice> --fail /dev/<olddisk> --remove /dev/<olddisk>
I would suggest doing one disk at a time the first time and checking the status of the raid array via mdstat as you go before removing the second (and potentially only viable disk) from the array. My only reason for suggesting this is experience teaches you to take several small steps rather than one large one and face total disaster recovery. Prevention is far better than cure.
I don't see how you can add two disks at the same time in the general case and migrate over. (I know that you can do things like that with LVM trickery if that's what you use for your RAID1.)
What looks like it should work in any case is this:
- pull old HD2
- insert new HD2
- wait for RAID to handle failure of HD2 by copying old HD1 onto new HD2
- pull old HD1
- insert new HD1
- wait for RAID to handle failure of HD1 by copying new HD2 onto new HD1
but I'm not a systems guy, so take this with a pinch of salt. Bear in mind that since we have failover events here, you won't get a capacity upgrade by doing this, even if the new HDs are bigger than the old ones, I think.
-
1This might be a bad idea. It's common for RAID arrays to die during recovery (copying) when one drive fails, because of the strain in the remaining disk(s). This is especially true if the disks are old and have the same age. If it's possible, adding a third (and possibly a fourth) disk to the array before removing the old drives is safer overall Jan 14, 2015 at 12:23
-
@goncalopp: True. My brain is somewhat stuck on the notion that RAID-1 would have <i>exactly</i> 2 instances of the payload (or 1 in failure mode), hence my confusion. Jan 14, 2015 at 14:02