qemu-kvm misinterprets LVM volume geometry

Bug #613619 reported by Hadmut Danisch
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qemu-kvm (Ubuntu)
Expired
Medium
Unassigned

Bug Description

Binary package hint: qemu-kvm

Hi,

when running qemu/kvm with kvm logical volumes as virtual disks, there's a severe problem, maybe with disk geometry.

When partitioning the lvm volume with fdisk or parted, generating the partition device entries with kpartx, creating filesystems (ext3, fat16,..) and installing a linux with debootstrap, there's quite often the problem that the virtual machine then has problems accessing the virtual disk, resulting in read errors (usually misinterpreting dos filesystems, beeing unable to mount or fsck an ext3 and so on).

Looks like the same problem as reported on http://qemu-forum.ipi.fi/viewtopic.php?f=4&t=5218

Sometimes the problem did not occur when I use fdisk in dos compatibilty mode and/or rebooting the host after creating the partition table.

Maybe that's a problem of disk geometry. Linux does not maintain a disk geometry for LVM volumes, so most tools like partition and filesystem generation tools use a default geometry of 255 heads and 63 sectors. On the other hand, the -drive option of qemu/kvm does not accept this geometry. The number of heads seems to be limited to 16. This is a severe problem since it can crash virtual machines and destroy data.

regards

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: qemu (not installed)
ProcVersionSignature: Ubuntu 2.6.32-24.38-generic 2.6.32.15+drm33.5
Uname: Linux 2.6.32-24-generic i686
Architecture: i386
Date: Wed Aug 4 22:21:59 2010
KvmCmdLine: Error: command ['ps', '-C', 'kvm', '-F'] failed with exit code 1: UID PID PPID C SZ RSS PSR STIME TTY TIME CMD
MachineType: TOSHIBA Satellite L300
ProcCmdLine: BOOT_IMAGE=/vmlinuz-2.6.32-24-generic root=/dev/mapper/nord-root ro quiet splash
ProcEnviron:
 PATH=(custom, user)
 LANG=de_DE.utf8
 SHELL=/bin/tcsh
SourcePackage: qemu-kvm
dmi.bios.date: 03/19/2008
dmi.bios.vendor: INSYDE
dmi.bios.version: 1.30
dmi.board.asset.tag: Base Board Asset Tag
dmi.board.name: Base Board Product Name
dmi.board.vendor: Intel Corp.
dmi.board.version: Base Board Version
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 1
dmi.chassis.vendor: Chassis Manufacturer
dmi.chassis.version: Chassis Version
dmi.modalias: dmi:bvnINSYDE:bvr1.30:bd03/19/2008:svnTOSHIBA:pnSatelliteL300:pvrPSLB0E-02T01XGR:rvnIntelCorp.:rnBaseBoardProductName:rvrBaseBoardVersion:cvnChassisManufacturer:ct1:cvrChassisVersion:
dmi.product.name: Satellite L300
dmi.product.version: PSLB0E-02T01XGR
dmi.sys.vendor: TOSHIBA

Revision history for this message
Hadmut Danisch (hadmut) wrote :
Scott Moser (smoser)
Changed in qemu-kvm (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Hadmut Danisch (hadmut) wrote :

Here are some discussions where I found problems mentioned that seem to be the same or closely related problem:

http://www.howtoforge.com/forums/archive/index.php/t-30329.html
http://ubuntuforums.org/showthread.php?t=1425421

I am not sure yet what exactly the reason is, but I experienced similar problems on several hosts, both with kvm and qemu. You can install a system on a partitioned lvm volume from the host, but once you boot it, the virtual machine can't mount it (or generates rubbish like reading files that have been deleted under FAT16).

Interestingly one of the commenters in the ubuntu discussion above mentioned that it worked when leaving space at the beginning of the lvm. I once tried to convert a regular ubuntu machine into an almost identical virtual copy for backup reasons. I first used fdisk -c with -u command (which results in different positions for the partitions), and when I bootet that virtual machine, it could mount only the first two partitions, but then ran into severe trouble when trying to mount the third filesystem (beeing unable to display file permissions or contents and such things). When I repeated everything with a regular old-fashioned fdisk (without -c and -u) it worked. But that was obviously some luck, since repeating this with lvm volumes of different size was not possible.

For some reason the virtual disk looks somehow different from inside (virtual machine) than from outside (host), and it might be related to the the beginning of the lvm volume.

Sergey Svishchev (svs)
summary: - qem/kvm misinterprets LVM volume geometry
+ qemu-kvm misinterprets LVM volume geometry
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Hi,

are you still having this problem?

In oneiric, I just did

    qemu-img -L 10G -n kvm1 schroots
    dd if=oneiric-vm.img of=/dev/schroots/kvm1

and then changed the libvirt definition of the oneiric-vm vm to have the following disk section:

    <disk type='block' device='disk'>
      <source dev='/dev/schroots/kvm1'/>
      <target dev='vda' bus='virtio'/>
    </disk>

And the host came up fine. I did not manually try fdisk+debootstrap. As others elsewhere have pointed out, fdisk won't clear out the whole first part of the LVM volume which can confuse the guest kernel, initramfs, mounter, etc. If doing

    dd if=/dev/zero of=/dev/LV1/lv bs=1M

first reliably works for you, then this would not be a qemu bug.

Changed in qemu-kvm (Ubuntu):
status: Triaged → Incomplete
Revision history for this message
Hadmut Danisch (hadmut) wrote :

Serge,

sorry, can't tell. I did not install any new virtual machine for some time. The existing ones are running reliably (see above).

So I actually don't know whether this problem still exists.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for qemu-kvm (Ubuntu) because there has been no activity for 60 days.]

Changed in qemu-kvm (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.