View Single Post
Old 23rd January 2009, 20:41
joostvdl joostvdl is offline
Join Date: Oct 2005
Posts: 34
Thanks: 0
Thanked 1 Time in 1 Post
Default Current solution

This is how I convert an qemu disk image to an LVM volume. It is to be noted that in the Logical Volume the same partitions are created as in the image file. So directly mounting of an LVM is not possible. To do that use kpartx to create multiple loopback devices which are mountable.

# qemu-img convert disk0.qcow2 -O raw disk0.raw
# lvcreate -n server-01_disk0 -L 10G VG01
{10G is total disksize of RAW file as defined in vmbuilder.partation}
{VG01 is name of LVM volume group}

# dd if=disk0.raw of=/dev/VG01/server-01_disk0 bs=1M
Change server-01.xml in /etc/libvirt/qemu:
    <disk type='block' device='disk'>
      <source dev='/dev/VG01/server-01_disk0'/>
      <target dev='hda' bus='ide'/>
# virsh define server-01.xml

Last edited by joostvdl; 23rd January 2009 at 20:44.
Reply With Quote