0

I want to move some KVM guests to VMWARE and therefore have to create VMDK images of the disks. The virtual disks for the guests are spread around multiple LVM volumes.

There are a couple of pointers that show that you can qemu-img convert an LVM volume. However in my case there are two volumes (say /dev/vg0/guestRoot and /dev/vg0/guestVar) for one KVM guest (/ and /var). In case it makes any difference: The mentioned volume group vg0 also contains the logical volumes for the other guests and the host as well.

Is it possible to create a single VMDK that contains both partitions of one guest? If not, can I perform the migration any other way?

musiKk
  • 127
  • 6
  • if you have /var and / in different volumes, i cannot concatenate two fs, so creare a new one and copy everything – c4f4t0r Feb 17 '14 at 17:21

1 Answers1

1

You can create a single partition, copy the root partition in the new one, the var partition in the new one, and finally make a dd of your complete partition into an image file.

So : shutdown your vm, then :

mount /dev/vg0/guestRoot /mnt/guestRoot
mount /dev/vg0/guestVar /mnt/guestVar

lvcreate -L XXG -n guestComplete vg0

mount /dev/vg0/guestComplete /mnt/guestComplete
cp -Rp /mnt/guestRoot /mnt/guestComplete
cp -Rp /mnt/guestVar  /mnt/guestComplete/var

umount /mnt/guestComplete

qemu-img convert ...

Then you can apply your conversion easily.

DrGkill
  • 976
  • 6
  • 8
  • I ended up creating one VMDK for each partition but I guess your solution could work too. Btw: Conversion worked even from a snapshot of the LVM volume; powering down not necessary. – musiKk Mar 06 '14 at 16:06