Configuring RAID1 after install

Paul Dwerryhouse paul at
Sat Mar 18 22:12:43 UTC 2006

On Sat, Mar 18, 2006 at 11:39:57AM -0600, John Lyon wrote:
> Maybe I'm extra dense this morning, but I'd like to configure RAID1 on a box
> that's already installed.

> Judging by what Webmin is telling me, I can't create a raid device using my
> boot drive, without destroying the boot drive to create the raid array.

Yes, you can. Build the raid, but force it to use only the new device
(ie, it will be running as a degraded raid).

Essentially, it will be something like this (assuming old partition is
/dev/hda1 and new partition is /dev/hdc1)

mdadm --create /dev/md0 --level=1 --force --raid-devices=1 /dev/hdc1

Then format the mirror, copy across your data from the first drive onto
it, adjust grub to boot with the mirror as the new root and

mke2fs -j /dev/md0
mount /dev/md0 /mnt
cd /
tar clBf - . | ( cd /mnt ; tar xBf - )
# now fix grub and reboot

Add the old drive into the mirror and then it will rebuild the raid. 

mdadm --manage -a /dev/md0 /dev/hda1

It will be handy if you can ensure that you can boot off a CD before
doing any of this; it's easy to make a mistake and render it unbootable.



Paul Dwerryhouse				| PGP Key ID: 0x6B91B584
Installing Debian Sarge with software RAID:

More information about the ubuntu-users mailing list