Red Hat Bugzilla – Full Text Bug Listing
|Summary:||qemu-img does not convert qcow2 correctly into VHD|
|Product:||[Fedora] Fedora||Reporter:||Joachim Metz <joachim.metz>|
|Component:||qemu||Assignee:||Fedora Virtualization Maintainers <virt-maint>|
|Status:||CLOSED NOTABUG||QA Contact:||Fedora Extras Quality Assurance <extras-qa>|
|Version:||16||CC:||amit.shah, berrange, cfergeau, dwmw2, itamar, knoel, pbonzini, rjones, scottt.tw, virt-maint|
|Fixed In Version:||Doc Type:||Bug Fix|
|Doc Text:||Story Points:||---|
|Last Closed:||2012-09-26 04:37:52 EDT||Type:||Bug|
|oVirt Team:||---||RHEL 7.3 requirements from Atomic Host:|
Description Joachim Metz 2012-09-15 04:10:23 EDT
Description of problem: * create qcow2 image * convert into VHD with qemu-img * data size of resulting VHD image is incorrect Version-Release number of selected component (if applicable): qemu-img-0.15.1-7.fc16.x86_64 qemu-img version 0.15.1, Copyright (c) 2004-2008 Fabrice Bellard How reproducible: tested on single image with consistent results. Steps to Reproduce: 1. create a 16384 M (17179869184 bytes) qcow2 image 2. convert to VHD using: qemu-img convert -f qcow2 -O vpc image.qcow2 image.vhd Actual results: Data size qcow2 image: 17179869184 Data size VHD image: 17180319744 450560 additional bytes in the VHD image Expected results: Data size qcow2 image: 17179869184 Data size VHD image: 17179869184 Additional info:
Comment 1 Paolo Bonzini 2012-09-26 04:37:52 EDT
Virtual PC images require the file size to contain an exact number of cylinders. The size of a disk is 512 * heads * cylinders/head * sectors/cylinder, and there are limitations on the values: - sectors/cylinder must be 17, 31, or 63 - cylinders/head must be less than 1024 unless sectors/cylinder is 63 - heads must be between 4 and 16 for sectors/cylinder = 17, otherwise always 16 In your case, sectors/cylinder must be 63 (because smaller values only work up to roughly 256MB disks) and heads must be 16. Thus, the size of the disk must be a multiple of 63*16*512 = 516096. In fact, the VHD image you get is exactly 512 * 16 heads * 33289 cylinders/head * 63 sectors/cylinder.
Comment 2 Joachim Metz 2012-09-27 02:05:54 EDT
Thanks for the explanation. According to the MS VHD specification this only applies to ATA disks. I'm not sure if MS still uses this restriction in the format, since VHD files can be larger than the 127 GB ATA media limit. Maybe it's useful that the qemu-img will print a notification if it's changing the characteristics of the disk image.
Comment 3 Paolo Bonzini 2012-09-27 06:54:27 EDT
My reading of the specification is that anything above 127GB will specify 65535/16/255 as the geometry, but your disk is smaller than that so it should be rounded. > Maybe it's useful that the qemu-img will print a notification if it's changing > the characteristics of the disk image. Yes, that would be useful.