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

Now suppose /dev/abcd/lvm4 is the virtual machine with which I am going to start this experiment.

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

Step 1 qemu-img create -f vmdk myos.vmdk 10G

After this step how do I go on populating the vmdk image I just created above with all that content which is in lvm? Any ideas to this part?

1 Answer 1

dd if=/dev/abcd/lvm1 of=myos.vmdk

if the myos.vmdk is not ok then do this

dd if=/dev/abcd/lvm1 of=my_raw_disk.img
qemu-img convert my_raw_disk.img myos.vmdk

there may be a few options that you want when you convert just look at man qemu-img.


it will be good if you can stop the vms during this operation, if not you can try it as is but ... you may want to look first at lvm snapshots.

  • Ohh that will take at least 100 GB of space.Since the VM is 100 GB in size.Is it not possible to reduce the size as the Virtual Machine has utilized only 11 GB of space in LVM.I am having space constraint.
    – Bond
    Jan 9, 2011 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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