Re: Virtualization With KVM On Ubuntu 8.10 (Problems with LVM)

Discussion in 'HOWTO-Related Questions' started by frippz, Jan 14, 2009.

  1. frippz

    frippz New Member

    This question is specific to part 6 of Virtualization With KVM On Ubuntu 8.10, specifically Creating an LVM based VM.

    I've followed the guide exactly and yet everytime after I've converted the qcow2 image to a LV using
    qemu-img convert disk0.qcow2 -O raw /dev/volumegroup/logicalvolume
    , I get the following error:

    Boot from (hd0,0) ext3 894e741d-97b0-461a-9709-147b24506905
    Starting up ...
    crc error
     -- System halted
    I saw another user in the Ubuntu forums that experienced the exact same problem, but no one had a solution (he had followed the same guide). People who have installed directly onto a LV did not experience this issue, but as far as I know, ubuntu-vm-builder does not yet support this.

    Any help with this would be very much appreciated!
  2. falko

    falko Super Moderator ISPConfig Developer

    Not sure what it is. Did you create a filesystem on /dev/volumegroup/logicalvolume, or did you just create the LV with lvcreate, nothing more?

    Any errors in your logs?
  3. frippz

    frippz New Member

    I just created the LV with lvcreate, yes. Then I used qemu-img to convert the image file.

    qemu-img convert disk0.qcow2 -O raw /dev/mogwai/milltime
    The only thing that shows up in /var/log/libvirt/qemu/milltime.log is:

    /usr/bin/kvm -S -M pc -m 1024 -smp 1 -name milltime -monitor pty -boot c -drive file=/dev/mogwai/milltime,if=ide,index=0,boot=on -net nic,macaddr=52:54:00:09:91:db,vlan=0 -net tap,fd=14,script=,vlan=0,ifname=vnet2 -serial none -parallel none -usb -vnc 
    char device redirected to /dev/pts/5
    info cpus
    Doesn't say much, from what I can tell. Are there any other logs I can check?

    edit: This wasn't mentioned specifically in the guide, but I did boot the machine from the disk0.qcow2 image first, in order to change the password for the account. I then proceeded to shut it down (from within the VM using sudo shutdown -h now) and changed the config file to point to the LV instead of the image file, redefined the VM in virsh and started it up again, which resultet in the crc error and "System halted"

    edit2: Oh yeah, here's the xml-file for the VM

    <domain type='kvm'>
        <boot dev='hd'/>
      <clock offset='utc'/>
        <disk type='file' device='disk'>
          <source file='/dev/mogwai/milltime'/>
          <target dev='hda' bus='ide'/>
        <interface type='bridge'>
          <mac address='52:54:00:09:91:db'/>
          <source bridge='br0'/>
        <input type='mouse' bus='ps2'/>
        <graphics type='vnc' port='-1' listen=''/>
    Last edited: Jan 15, 2009
  4. joostvdl

    joostvdl Member

    Same problem here


    I have the same problem here.

    Still looking for an answer.

    Another problem I found with VM BUilder is that the memory calculation is not correct. It gives no good result.
  5. frippz

    frippz New Member

    I just finished some testing using qemu-img to convert the qcow2 file to a raw file, just to see if that would work to boot from, which it did actually. So I'm guessing that something goes wrong when the conversion goes straight to the LV. I just wish I knew what exactly...

    edit: Just for fun, I tried to use dd to copy the raw file to the LV. Lo and behold, the damn thing could now boot off the LV. A little hassle with this workaround, sure, but it seems to work. :)

    I'm not quite ready to call this one solved yet, but it's a very good start! :)
    Last edited: Jan 15, 2009
  6. falko

    falko Super Moderator ISPConfig Developer

    Ok, that's the correct way.

    I wonder why it worked for, and why so many users have this problem now - maybe Ubuntu updated the packages since I wrote the tutorial? I think I have to check again when I find some time...
  7. joostvdl

    joostvdl Member

    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.

    {10G is total disksize of RAW file as defined in vmbuilder.partation}
    {VG01 is name of LVM volume group}

    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'/>
    Last edited: Jan 23, 2009
  8. Slasher

    Slasher New Member

    The problem seems to be that qemu-img convert doesn't overwrite the entire volume and if the volume contains non-zeroed data that will confuse the file system. So you need to do dd bs=1M if=/dev/zero of=LVM_volume before calling qemu-img to write the output directly to the LV.
  9. Nakarti

    Nakarti New Member

    Yay, how to put Windows XP on KVM LVM

    May we all thank Frippz for the procedure to get Windows XP working as LVM in a KVM guest!
    I think the reason direct copy doesn't work is that it retains the MBR in a different location for qcow, but LVM only functions as a raw disk... (That is probably why my LVM install isn't working: I didn't specify raw.)

    (Removed the quote because it was mangled)
    So: Install Windows to a qcow file, qemu-img convert it to raw, dd that to LVM, and boot LVM.
    Last edited: Jan 16, 2012
  10. Nakarti

    Nakarti New Member

    Now I get a green screen instead of boot! What the fish!

    (ps. Seriously? Not working 3 years later? Does *anybody* do this?)
    Last edited: Jan 17, 2012

Share This Page