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,559
  • 5
  • 24
  • 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
  • 79,345
  • 17
  • 128
  • 213
  • Is gnome-disk-utility a front-end for mdadm? Or is it something different? I think in most cases, however, you'll need to tell whatever is controlling the RAID to add the new disk to the RAID array. After doing so, it'll immediately start to rebuild the array with the new disk (which is the case with mdadm). – Safado Jun 08 '11 at 16:04
  • @Ryan - gnome-disk-utility is (mostly) a partition manager, but Linux utilities have a way of becoming octopodes (grabbing up extra functionality until they become nigh-unusable) so it's possible someone has hooked mdadm functionality into it. I'm a BSD guy, and generally stick to the command line anyway so I don't know much about the Linux GUI tools... – voretaq7 Jun 08 '11 at 16:11
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
  • 338
  • 1
  • 7
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,557
  • 18
  • 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