convert vm image into lvm based vm

Discussion in 'HOWTO-Related Questions' started by guzzi_jones, Aug 22, 2014.

  1. guzzi_jones

    guzzi_jones New Member

    i followed the excellent tutorial here:

    I get to the step to convert the image vm into the lvm and get the following error:

    qemu-img: /dev/mapper/vg0-vm1: error while converting raw: No space left on device

    here is my logical volume i created:
    Disk /dev/mapper/vg0-vm1: 10.7 GB, 10737418240 bytes
    255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk identifier: 0x00000000

    Any suggestions on how to convert this image vm into an LVM based vm? thanks.
  2. srijan

    srijan New Member HowtoForge Supporter

    It states that your device capacity is full, it cannot create its image file as no space is remaining over the disk.
  3. guzzi_jones

    guzzi_jones New Member

    I just created the lvm parition and did not even format it. how could it be full already?

    Or is it complaining another paritition is full. I have plenty of disk space open on my root parition.

    I am running ubuntu 12.04 64 bit on :
    software Mirrored raid with lvm over the top

    I did find this post which creates a raw file first then copies it to the lvm. I could try that
    Last edited: Aug 22, 2014
  4. guzzi_jones

    guzzi_jones New Member

    my lvm was too small. the error was valid. i resized the lvm and it works now.
  5. guzzi_jones

    guzzi_jones New Member

    once i copy the vm to the lvm partition i now get this error when attempting to start it:
    virsh # start vm1
    error: Failed to start domain vm1
    error: internal error process exited while connecting to monitor: kvm: -drive file=/dev/vg0/vm1,if=none,id=drive-ide0-0-0,format=qcow2: could not open disk image /dev/vg0/vm1: Invalid argument
  6. guzzi_jones

    guzzi_jones New Member

    I could not copy the vm to the lvm. I think it was due to the fact that the logical volume was not the exact same size as the vm image. I could not reliably determine the size the
    lvm needed to be

    I first created the network bridge per how to

    i ended up following these instructions:

    the vmbuilder.parition file is not the correct size for GB paritions
    mine looks like this:
    root 102400
    swap 2048
    which will give me a 10G root parition and a 2 G swap parition.

    then i created the lvm with:
        lvcreate -L 102G -n vm1 vg0
    creating a 102 Gig lv in the volume group vg0

    then i created my vm directly in the lv drive like so:
       vmbuilder kvm ubuntu --suite=precise --flavour=virtual --arch=amd64 --mirror= -o --libvirt=qemu:///system --ip= --gw= --part=vmbuilder.partition --templates=mytemplates --user=ajonen --name=ajonen --pass=xxxx --addpkg=vim-nox --addpkg=unattended-upgrades --addpkg=acpid --addpkg=linux-image-generic --firstboot=/var/lib/libvirt/images/vm1/ --mem=2048 --hostname=vm1 --bridge=br0 --raw=/dev/vg0/vm1
    adjust the memory, ip, gateway, name, and -raw command as above.

    Everything worked as expected, except openssh did not install and start. oh well. :)
    I hope this helps someone.

    i am running ubuntu 12.04 on software raid,lvm setup

Share This Page