I am experimenting with KVM-based VMs on my home server. The host runs Ubuntu Server 16.04.1 LTS, and so would the guests.

I was able to create a guest using vmbuilder. It outputs a qcow2 image, which I then converted to raw image on a LVM logical volume to improve performance. The total size of this image is about 900MB, and it works well for what I need.

However, when I manually create a VM and install Ubuntu from the ubuntu server ISO onto it, I am able to expose my logical volume to the VM guest as a block raw device rather than file raw image. In my testing, this seems to generally improve disk performance even further, by not insignificant margins, depending on how I test. However, this VM is not nearly as lean (installed 1.8GB or so) and boot time is much slower (the block device VM created by vmbuilder boots in about 5 seconds, the file-based VM that I manually installed in about 15 seconds).

So my goal is to have a VM that is like the one vmbuilder installs, fewer packages, fast boot, etc, but to have it use a raw block device as storage instead of the file-based raw image.


  1. How is the VM created by vmbuilder different from when I manually install it?

  2. I see that Ubuntu (used to ) have Ubuntu JeOS and see references that it can be installed from the Server iso, but I can't find out how. Is this still an option? If so, is that what the vmbuilder installs?

  3. How can I create a vmbuilder-like system manually OR how can I convert the qcow2 image to raw block rather than raw file image.


This has not gotten an answer, but I was able to find a partial solution. What I found is this article, which describes how to convert the Qcow2 image to a raw block device, rathern than raw file image.

Basic steps:

  1. VM needs to be off
  2. Convert qcow2 to raw image file using:

    qemu-img convert [qcow2] [rawimg]

  3. Get size of raw image in bytes:

    ls -l [rawimg]


  4. Create LV and match size of raw image exactly:

    lvcreate -L 123456789b -n [lvname] [vgroup]

  5. Write raw image to LV:

    dd if=[rawimg] of=[path/to/lv]

Change the XML definition of the VM accordingly, for example from:

<disk type='file' device='disk'>
  <driver name='qemu' type='qcow2' cache='none'/>
  <source file='/srv/virtual/vm_web/tmp5GWO4q.qcow2'/>
  <target dev='hda' bus='virtio'/>


<disk type='block' device='disk'>
  <driver name='qemu' type='raw' cache='none'/>
  <source dev='/dev/vgroup/lv_disk'/>
  <target dev='vda' bus='virtio'/>

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.