cloning a kvm guest os to a vmdk file

Posted by Bond on Server Fault See other posts from Server Fault or by Bond
Published on 2011-01-07T06:16:59Z Indexed on 2011/01/07 6:55 UTC
Read the original article Hit count: 372

I have a production environment where I am having 4 Guest OS running on a Ubuntu server which uses kvm. These OS are in an LVM based setup.I want these Virtual Machines to be in a vmdk format also.Where people would do experiments with these Virtual Machines so this in a vmware environment (or it can be Xen too) would be different from the kvm server.I would not have any control on that other environment so I want to give people vmdk images of these virtual machines.

The production Virtual Machines will still keep running on kvm server but the VMs on which experiments would be done would be of type vmdk.(vmdk is a constraint)

Here is output of lvscan

 ACTIVE            '/dev/abcd/lvm1' [100.00 GiB] inherit
  ACTIVE            '/dev/abcd/lvm2' [150.00 GiB] inherit
  ACTIVE            '/dev/abcd/lvm3' [50.00 GiB] inherit
  ACTIVE            '/dev/abcd/lvm4' [100.00 GiB] inherit

I was reading man page of qemu-img and what I understand is I need to first create a qcow image file which I need to populate and then convert that to a vmdk file. Is that understanding correct?

Now suppose /dev/abcd/lvm4 is the virtual machine with which I am going to start this experiment.I can shutdown the production VMs for some time to do this.

So is the following way correct to go on server 1 (where kvm is running)

qemu-img convert -c -f raw -O vmdk /dev/abcd/lvm4 /backup/lvm4.img

or it will affect the lvm4 on kvm server 1.

I do not want the VM running on original server to at all loose its any of the content but also have a vmdk file for each of the Guest OS on kvm.

Before I proceed with any of the above things on the production machine I just want to make sure that I am doing the correct thing so I asking here.

© Server Fault or respective owner

Related posts about kvm

Related posts about server-migration