HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   Re: Virtualization With KVM On Ubuntu 8.10 (Problems with LVM) (http://www.howtoforge.com/forums/showthread.php?t=30329)

frippz 14th January 2009 13:05

Re: Virtualization With KVM On Ubuntu 8.10 (Problems with LVM)
 
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
Code:

qemu-img convert disk0.qcow2 -O raw /dev/volumegroup/logicalvolume
, I get the following error:

Code:

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!

falko 15th January 2009 13:45

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?

frippz 15th January 2009 15:40

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

Code:

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

Code:

/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 0.0.0.0:1
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

Code:

<domain type='kvm'>
  <name>milltime</name>
  <uuid>0a721358-9107-aa88-2ca5-92b983865adb</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <source file='/dev/mogwai/milltime'/>
      <target dev='hda' bus='ide'/>
    </disk>
    <interface type='bridge'>
      <mac address='52:54:00:09:91:db'/>
      <source bridge='br0'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' listen='0.0.0.0'/>
  </devices>
</domain>


joostvdl 15th January 2009 21:10

Same problem here
 
Hi

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.

frippz 15th January 2009 21:18

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! :)

falko 16th January 2009 13:00

Quote:

Originally Posted by frippz (Post 164751)
I just created the LV with lvcreate, yes. Then I used qemu-img to convert the image file.

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...

joostvdl 23rd January 2009 19:41

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.

Quote:

# 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}

Quote:

# dd if=disk0.raw of=/dev/VG01/server-01_disk0 bs=1M
Change server-01.xml in /etc/libvirt/qemu:
Code:

    <disk type='block' device='disk'>
      <source dev='/dev/VG01/server-01_disk0'/>
      <target dev='hda' bus='ide'/>
    </disk>

Quote:

# virsh define server-01.xml

Slasher 26th April 2009 16:50

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.

Nakarti 16th January 2012 16:39

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.

Nakarti 17th January 2012 00:09

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

(ps. Seriously? Not working 3 years later? Does *anybody* do this?)


All times are GMT +2. The time now is 07:53.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.