I currently have a 500GB x5 RAID-5 array in Fedora Linux using mdadm. One of the disks went bad and I'm going to move all the disks and data to a new array. However can I reduce the size of the array in the mean time down to 4 disks to prevent the unthinkable of another disk failing? I'd need to do it without re-creating the array because I currently have no storage space large enough to hold the data.
|
|
No, you can't decrease the number of devices in a RAID array using mdadm. From
Verify your backups are OK, then rebuild the array from scratch with the appropriate number of disks and restore from backup onto the array. |
||||
|
|
|
As womble said, you can't drop a disk and shrink a RAID. There are probably some things you should know about RAID. First, RAID 5 is no longer considered a good practice for large drives or large arrays. The reason is that the liklihood of a read error from one of the drives when replacing a failed drive becomes a lot closer to 1:1 with the larger / more numerous drives. Best practices are now RAID 6, which provides two parity drives, or RAID 10, which gives better performance, but slightly less fault tolerance (you can lose 2 drives in some circumstances). Also, when you're building decently-sized arrays, you might consider adding a hot spare that automatically swaps in for a failed member without your intervention. Of course, that doesn't get you your data. Assuming you've got a 5x500GB array, you've got around 2TB of usable space. If you have backups, then you really need to recover from those after recreating the array. Since it sounds like you don't have backups, first, good luck. Second, it's time to get some sort of secondary storage post haste. I would recommend an external 2TB drive. They're running around $160 on pricewatch.com. If for whatever reason you can't do that, try to logically break it up and dispatch it to several other machines while you rebuild the array. You probably want to hurry. |
|||
|
|
|
From the other answers it seems clear that you can't just 'shrink' the raid. However, I feel that one of the points of RAID5 when using it for redundancy is that you can just slot out the faulty disk and slot in a new one? I don't think you have to rebuild the whole array... I'm fairly sure, but test this on your own lab network first, use this at your own risk, don't use this in a production environment without having tested and validated it according to your preferred validation procedures first, etc ... : See the current status of the array, let's say it's /dev/md0:
... shows you the current status of the array, each device etc. Set the old drive faulty and remove it from the array. Let's say the faulty drive is /dev/sdg:
At this point, if you do sudo mdadm --detail /dev/md0 , you should see that that drive has been removed from the array. Shut down the computer, swap out the old drive, plug in the new one, start up the computer. Start up the array with the drive missing. Let's say the other devices were /dev/sdf and /dev/sdh, so:
... replacing the missing device name with the word 'missing'. The array should start up. Now add in the new device/disk. Let's say the new disk is /dev/sdg again:
mdadm should add the new device to the array, and start rebuilding the array onto it. You can check by doing:
|
||||
|
|