Ubuntu raid - replacing drive?
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
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:
- Select the RAID
- Edit Components
- Add Spare
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:
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.
Disk Array Operation
Note: You can add, remove disks or set them as faulty without stopping an array.
- To stop an array, type:
$ sudo mdadm --stop /dev/md0
Where /dev/md0 is the array device.
- 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.
- 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