I've set up software RAID1 with the latest Ubuntu version - 11.04 using two 250GB harddrives which initially worked great. Tried to unplug both and computer still started with degraded raid status - reconnecting and rebooting makes the resync perform automatically. Everything good this far.
Unfortunately this morning, one of the harddrives died and when opening the Disk tools or gnome-disk-utility as its called, the main RAID chain shows as degraded.
If I run away to the store and get a new harddrive and plug it into the computer, will everything work out as intended or do I need to partition stuff as I did while installing Ubuntu with the Alternate installer?
The answer is "Yes, but..." -- You will probably need to tell the software RAID system (mdadm) that the drive has been replaced, following steps similar to these (I wasn't able to find a more ubuntu-specific way of doing this, but you may be able to do it through gnome-disk-utility as well).
The answer is "Yes, everything will work out as intended once you partition stuff." You can do it manually with
fdisk
orparted
followed bymdadm
, but the packagegnome-disk-utility
contains (is) the toolpalimpsest
which can do the whole job with GUI pointy-clicky:and magic happens. A rebuild will take some not-insignificant time.
(Don't ask how I know.)
There is a trick to restore the partition table (and grub) to your new drive from the old:
where /dev/sda is the working old raid drive and /dev/sdb is the new replaced drive.
After forcing the re-reading of /dev/sdb partition table with hdparm -z /dev/sdb, you can add the new drive to the raid with mdadm /dev/mdX --add /dev/sdbX
Fast and without rebooting.
Disk Array Operation
Note: You can add, remove disks or set them as faulty without stopping an array.
$ sudo mdadm --stop /dev/md0
Where /dev/md0 is the array device.
$ sudo mdadm --remove /dev/md0 /dev/sda1
Where /dev/md0 is the array device and /dev/sda is the faulty disk.
$ sudo mdadm --add /dev/md0 /dev/sda1
Where /dev/md0 is the array device and /dev/sda is the new disk.
Note: This is not the same as "growing" the array!
4.Start an Array, to reassemble (start) an array that was previously created:
$ mdadm --assemble --scan
mdadm will scan for defined arrays and start assembling it. Use this to track its status:
$ cat /proc/mdstat