Red Hat Bugzilla – Bug 491981
Integer wraparound creating a large disk image in VPC format
Last modified: 2009-05-19 20:53:17 EDT
Description of problem:
Try and create a 5 TB disk image
# qemu-img create -f vpc foo.cow 5000G
Formatting 'foo.cow', fmt=vpc, size=5242880000 kB
...you don't get a 5 TB image out the other side
# qemu-img info foo.cow
file format: vpc
virtual size: 127G (136899993600 bytes)
disk size: 264K
At least qemu-img doesn't SEGV though, so its better than qcow2 :-)
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.qemu-img create -f vpc foo.cow 5000G
127G disk image
5 TB disk image
Does chris' patch in the qcow2 bz fixes this too?
I can't see how Chris' patch would help, since its against block-qcow2.c not block-vpc.c :-)
This is not a wraparound but the maximum value supported by the CHS calculation algorithm in the VHD specification - and I tried to stay close to the spec when implementing VHD write support.
Is it even possible to create that large images with Virtual PC? If so, qemu-img should behave the same, even if this means deviating from the spec.
I'm not sure if Virtual PC / VHD spec allows for disks this big - I was just trying to confuse qemu-img code and see what happened :-)
If we can't support 5 TB disks, then I'm happy for qemu-img to explicitly refuse to create this disk, and give an error message back telling the user their requested disk size is too large.
I would really like to know what Virtual PC does. Do you have a Windows machine or VM by any chance where you could try this? Currently I don't have the hardware yet to do that myself.
If Virtual PC behaviour matches the spec and the limitation is going to stay, I agree that an error message is a better solution than silently creating a smaller image.
Running Virtual PC 2007 SP1 on Vista x64, and creating a "dynamically expanding" virtual hard disk, Virtual PC states that the maximum virtual hard disk size is "130,557 MB". I tried entering 500000 MB anyhow and it comes back with a message, "Please enter a size value between 3 MB and 130,557 MB."
Interestingly, when I try to create a "fixed-size" virtual hard disk instead, the maximum claims to be 375,493 MB. I think that is being limited by the free space on the disk at the time I run the utility since I currently have 366 GB free on that partition. I don't have a larger partition to play with.
Thanks for trying it out. This confirms what I found on the internet. I have already sent a patch to qemu-devel last week which aborts with an error message when you want create too large VHD images. It doesn't seem to be applied yet, though.
Please note that the qemu VPC format is only used for dynamic disks. For fixed size disks you would use the raw driver.
The patch has now been applied in upstream qemu as SVN Rev 7109.
Thanks Kevin, closing this as resolved upstream - no particular need to fix this for F11
qemu-0.10.4-2.fc11 has been submitted as an update for Fedora 11.
qemu-0.10.4-3.fc11 has been submitted as an update for Fedora 11.
qemu-0.10.4-4.fc11 has been submitted as an update for Fedora 11.
qemu-0.10.4-5.fc11 has been submitted as an update for Fedora 11.
qemu-0.10.4-4.fc11 has been pushed to the Fedora 11 stable repository. If problems still persist, please make note of it in this bug report.