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 groupvg0
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?
Answer
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.
Attribution
Source : Link , Question Author : musiKk , Answer Author : DrGkill