raid1 on existing single drive server

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Tue Sep 25 19:38:45 UTC 2007


On Tue, Sep 25, 2007 at 11:28:23AM -0400, Teddy Mills wrote:
> Is it possible to install RAID1 on a existing single drive server?
> 
> ext3 /boot
> ext3 /
>       /swap
> 
> changing the type from ext3 to "fd" raid autodetect.
> Will that kill the existing data?

Changing the type means nothing to the data.

> And what about mkfs.ext3 /dev/mdX?
> (i am sure that will wax the data)

That would certainly destroy data.

> What other options are there other than stopping the server and drive 
> imaging it ?

Install new drive
partition new driver however you want for raid setup
create degraded raid1 on new drive (specifying 'missing' in the config
where you have the old drive) using mdadm
create filesystem on new md raid device
mount new filesystem and copy data there and install bootloader on new
drive.
reboot using new device as root and if everything works, repartition old
drive to match new drive, then hotadd (using mdadm again) the old drive
to the raid and wait for resync to complete (/proc/mdstat has info).

Ensure bootloader is installed properly.

I generally install bootloader to primary drive and then just dd the
first sector from the primary to secondary drive which ensures identical
partition table and boot sector and makes sure it all matches.

Or you could backup all the data somewhere else and do it from scratch.

I have done this many times and it works just fine, but you do have to
know how to manually deal with grub and passing root options and such to
boot it up while doing the transfer to the raid setup as well as
generating new initramfs to handle everything for setting up the raid at
boot before mounting it (On debian the initramfs-tools seem to do this
correctly automatically in combination with mdadm).

--
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list