5

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?

Industrial
  • 1,609
  • 6
  • 26
  • 37

4 Answers4

6

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).

voretaq7
  • 80,749
4

The answer is "Yes, everything will work out as intended once you partition stuff." You can do it manually with fdisk or parted followed by mdadm, but the package gnome-disk-utility contains (is) the tool palimpsest which can do the whole job with GUI pointy-clicky:

  1. Select the RAID
  2. Edit Components
  3. Add Spare

and magic happens. A rebuild will take some not-insignificant time.

(Don't ask how I know.)

mlp
  • 348
2

There is a trick to restore the partition table (and grub) to your new drive from the old:

dd if=/dev/sda of=/dev/sdb count=1 bs=512

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.

Giovanni Toraldo
  • 2,607
  • 21
  • 27
1

Disk Array Operation

Note: You can add, remove disks or set them as faulty without stopping an array.

  1. To stop an array, type:

$ sudo mdadm --stop /dev/md0

Where /dev/md0 is the array device.

  1. Remove a Disk from an Array

$ sudo mdadm --remove /dev/md0 /dev/sda1

Where /dev/md0 is the array device and /dev/sda is the faulty disk.

  1. Add a Disk to an Array

$ 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