[linux-lvm] Live Cloning of Root LVM (or Dynamic LVM?)

Thierry Thelliez thierry.thelliez.tech at gmail.com
Wed Jul 18 17:38:18 UTC 2007


I wanted to perform a live clone of a remote server main drive . The
constraint would be to do that while the system is still running
(without booting from a LiveCD). In case of crash or damage to the OS
or applications settings, the idea would be to be back with minimal
intervention: just remove the bad drive and boot from the clone.

I thought it could be easy but I am encountering some problems with
LVM configuration duplication.

Below are the steps I followed:
1- Main OS
The OS is installed on the main drive:
/hda1 = /boot ext3
/hda2 = LVM
The LVM is itself split in three:
VolGroup00/LogVol00 = /  ext3
VolGroup00/LogVol01 = swap
VolGroup00/LogVol02 = /data

2- Clone preparation
I added a second drive for the cloning. Manually configured the
partitions and LVM to look like the main drive.
/hdb1 = /boot ext3  (fdisk then mkfs.ext3 and e2label)
/hdb2 = LVM (fdisk then LVM created with Fedora core 6 LVM GUI)
The LVM is itself split in three:
VolGroup01/LogVol00 = /  ext3
VolGroup01/LogVol01 = swap (+mkswap /dev/VolGroup01/LogVol01)
VolGroup01/LogVol02 = /data

(In my current configuration the two drives are not the same
brand/size. Also I am not trying to clone the /data volume. So
everything is the same size but the */LogVol02 volumes).

3- Copy
I created a snapshot of VolGroup00/LogVol00 and dd it to VolGroup01/LogVol00
Of course the above is taking VolGroup00 references to the VolGroup01
The /boot was copied with cp -av

4- Modification of LVM references.
I booted from a knoppic CD to mount hdb and modify few LVM references
(changed VolGroup00 to VolGroup01).
/boot/initrd-xyz.fc6.img (with gzip, cpio,..)

5- MBR
Still under knoppic CD, I also created an MBR (mounted proc and dev,
then chroot to the clone drive, then grub root and setup).

Now if I boot from the clone, the MBR seems to work. Grub starts. But
just after the 'Uncompressing kernel' message, I get an error about
allocating Ram0 (grow_buffer: requested out of range block ... for
device Ram0). I am guessing the a reference of the VolGroup00 is left
somewhere. Or maybe a swap definition issue?

Any suggestions on what to clean on the clone to make it working?
Somehow I was hoping that the LVM information would be dynamically
read. But there must be some hidden references left.


More information about the linux-lvm mailing list