Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
if you have /var and / in different volumes, i cannot concatenate two fs, so creare a new one and copy everything –  c4f4t0r Feb 17 at 17:21
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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 6 at 16:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.