[vbox-dev] VMDK inflation and grain alignment/padding

Christian Svensson christian at cmd.nu
Thu Feb 18 10:48:09 UTC 2016


Hi,

I was debugging why my VMware products were able to accept an OVA but not
VirtualBox.
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;
    return rc;
}

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
least.
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
VirtualBox?
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?

Thanks,
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.virtualbox.org/pipermail/vbox-dev/attachments/20160218/41468e4d/attachment.html 


More information about the vbox-dev mailing list