Bug Track: Issue With Block/vmdk
Bug report:
I tried to boot the vmdk generated by the Haiku build system here but it aborted.
It seems the header has the capacity field set to 0, to mean that there is no embedded grain directory if I understand the vbox sources…
At least the same image boots perfectly in VBox.
If anyone wants to test :
http://haiku-files.org/vmware/
any image should do.
They are generated by:
http://dev.haiku-os.org/browser/haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp#L303
The mention in vbox:
http://www.virtualbox.org/browser/trunk/src/VBox/Storage/VMDK.cpp#L2796
I might have a closer look at some point but I don’t know when.
François.
The haiku vmdk image is special, it is composed of
Host Sparse Extent Header + Descriptor file + Flat data
Where header fields capacity, gdOffset
and
rgdOffset
are zero, and the following descriptor specifies the extent to be
FLAT pointing to the file itself with offset 128 and the data start from offset
0×10000.
Using sparse header with flat data is uncommon, and obviously beyond definition of the specification. However both VMware and VirtualBox support such case. Furthermore, as it is tested, the vmdk file name must be the same with the one in descriptor for VMware to be correctly attached, just like how descriptor file + separate flat extent work.
The solution could be:
Test header.capacity
when opening, when it is zero (which should never be for
normal sparse vmdk), abort opening it as normal sparse but instead reopen by
the descriptor.