Link to home
Start Free TrialLog in
Avatar of barthalamu
barthalamu

asked on

Mirror existing system disk

I have a CentOS 5 machine set up with LVM2 set up on the first disk /dev/sda.  The other disk is /dev/sdb.  They are idential disks  and I would like to mirror them but have not been able to do so.  It must be possible to mirror /dev/sda to /dev/sdb even though it has already been partitioned and is in use, but I have not been able to figure out how.  The disks look like this:

fdisk -l

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       30401   244091610   8e  Linux LVM

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          13      104391   83  Linux
/dev/sdb2              14       30401   244091610   8e  Linux LVM


When I try to mirror the first partition, I get the following:
mdadm --create /dev/md0 --level=1 --chunk=1024 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm: Cannot open /dev/sda1: Device or resource busy
mdadm: create aborted


Do I need to boot to a CD distribution like knoppix to do this?  Thanks for any help you can give me.
Avatar of PUNKY
PUNKY
Flag of United States of America image

Look at this tutorial. It's for novel, but works for any Linux OS.
http://www.novell.com/coolsolutions/appnote/15087.html
Avatar of barthalamu
barthalamu

ASKER

Thank you both.

PUNKY - Although this would work during installation, I already have a system installed.  I just need to make a RAID1 out of my existing boot/system disk.

ravenpl - This is very interesting, but it does not look like it is for LVM on RAID.  I suspect that it will probably not work, although I'm not sure.  I can seem to find the information of how to create a RAID1 mirror when I already have a system installed on /dev/sda using LVM.
ASKER CERTIFIED SOLUTION
Avatar of ravenpl
ravenpl
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks ravenpl.  I think I can make this work with LVM instead of regular partitions.  Thanks.