[vbox-dev] VMDK inflation and grain alignment/padding
christian at cmd.nu
Thu Feb 18 10:48:09 UTC 2016
I was debugging why my VMware products were able to accept an OVA but not
Turns out that the problem was that my underlying hard drive image was not
aligned to the grain size (128 sectors in my case) and that caused
VirtualBox to throw VERR_VD_VMDK_INVALID_FORMAT.
For the record, this is a stream optimized VMDK generated by qemu-img.
This is the code snippet from src/VBox/Storage/VMDK.cpp:vmdkFileInflateSync:
if (cbActuallyRead != cbToRead)
rc = VERR_VD_VMDK_INVALID_FORMAT;
cbToRead is set to VMDK_SECTOR2BYTE(pExtent->cSectorsPerGrain). In my VMDK
generated by qemu-img (qemu HEAD as of a few days back) this check fails
for the last grain:
cbActuallyRead: 50176, cbToRead: 65536
Removing this check seems to provide a working result. The VM boots at
For now I made sure to align my underlying drive image to a 64KiB boundary
which solves the problem I'm having.
Long term however my question is: Is this a problem on qemu-img's side or
Even if qemu-img shouldn't generate these VMDK files, is there any merit to
removing the check out of compatibility with VMware products? Does the
standard take a stance in any direction?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vbox-dev