Comments on How to replace a failed harddisk in Linux software RAID
This guide shows how to remove a failed hard drive from a Linux RAID1 array (software RAID), and how to add a new hard disk to the RAID1 array without losing data. I will use gdisk to copy the partition scheme, so it will work with large harddisks with GPT (GUID Partition Table) too.
6 Comment(s)
Comments
Thanks for the tutorial. There's a typo somewhere ('sdgisk' or something). But otherwise, great ;)
(BTW: It's pretty sad that such a complicated process is necessary to replace a faulty disk. That's why Linux will never catch up as a desktop operating system ;))
Awesome! Worked perfectly for me. Thanks!
That optional step to save a copy of the backup table saved my behind after making a syntax error. Thank you so much for the tutorial. For what its worth, I was able to restore the partition table by running this series of commands (which I'm sure can be shortened):
sgdisk /dev/sdc
Press R for recovery
Press L to restore partition table from backup
Type backup location (your's may differ) /root/sdc.partitiontable
Press W to write partition table to disk and exit
What about the boot sector and installing grub? You could end up with a system that won't boot.
If the drive you're looking to replace is physically removed before you're prepped it as described above, it may show up in /proc/mdstat even after it's physically removed. mdadm can help you clean up that sort of entry, too:mdadm /dev/md4 -r detached
I replaced a failed 750G HD in my RAID1 set with a new 1TB one. Once synched, I failed and replaced the other 750GB with a 1TB. However, the RAID set still shows as a 750GB. I understand this is normal, however, I have been trying to find a definitive answer as to expanding to use the full size of the disks. Do I need to shutdown the RAID set and use gparted on each disk individually to add the unallocated space to the partition, or can I just use mdadm commands on the RAID set to do this?