[vbox-dev] fixed - VHD not readable by Hyper-V

Klaus Espenlaub Klaus.Espenlaub at Sun.COM
Fri Oct 16 12:13:25 GMT 2009


Huihong Luo wrote:
> No problem. Can you shed some lights on why writing to vhd is so much slower than to vmdk? Considering that these two are so similar in layout. Only diff is the bitmap on VHD

Don't have time to do an in-depth investigation, but the bitmap is 
certainly the prime suspect. The bitmap is not cached (VMDK has a block 
mapping cache, and VDI has the entire block map in memory, just like 
VHD). For VHD, each write operation first reads the corresponding bitmap 
entry, and if the bitmap is updated then there is an additional write as 
well. This case is triggered a lot for writes to a new VHD image. 
Windows is certainly not famous for its file cache efficiency.

Hope this gives a few hints what to tweak to get better performance.

Klaus

> Sent from my iPhone
> 
> On Oct 15, 2009, at 4:24 AM, Klaus Espenlaub <Klaus.Espenlaub at Sun.COM> wrote:
> 
> Huihong Luo wrote:
> found another bug, I've attached the patch
> two bugs:
> (1) parent locators set to zero for base images
> (2) block allocation table to be block-size aligned (2M)
> after these two fixes, vbox vhds works well on Hyper-V, I tested quite some large vhd files from p2v, all works fine now.
> These two fixes should be very safe to check in, (not sure if it may break snapshots, though)
> 
> Thanks a lot for those fixes (and the previous ones as well), I'll try to find time myself to apply them in the near future - or find someone else who will handle it.
> 
> What I wanted to ask earlier already - did you read http://www.virtualbox.org/wiki/Contributor_information ? Which of the two contribution options (SCA or MIT licensed patches) do you pick?
> 
> Again, we're very grateful for the excellent contributions.
> 
> Klaus
> 
> - hl
> --- On *Tue, 10/13/09, Huihong Luo /<huisinro at yahoo.com>/* wrote:
>    From: Huihong Luo <huisinro at yahoo.com>
>    Subject: Re: [vbox-dev] Fwd: VHD not readable by Hyper-V
>    To: "vbox-dev at virtualbox.org" <vbox-dev at virtualbox.org>
>    Date: Tuesday, October 13, 2009, 1:40 PM
>    I found the vhd bug on vbox implementation. vbox mistakenly sets
>    parent locators ("wi2r", etc.) for base vhd image. If setting these
>    fields to zeros for base image, Hyper-V is happy. Should be very
>    easy to fix, if you need the code diff, let me know
>    VBox The MS spec states:
>    Parent Locator Entries
>    These entries store an absolute byte offset in the file where the
>    parent locator for a differencing hard disk is stored. This field is
>    used only for differencing disks and should be set to zero for
>    dynamic disks.
>    --- On *Tue, 10/13/09, Huihong Luo /<huisinro at yahoo.com>/* wrote:
>        From: Huihong Luo <huisinro at yahoo.com>
>        Subject: [vbox-dev] Fwd: VHD not readable by Hyper-V
>        To: "vbox-dev at virtualbox.org" <vbox-dev at virtualbox.org>
>        Date: Tuesday, October 13, 2009, 6:49 AM
>        Sent from my iPhone
>        Begin forwarded message:
>        *From:* Huihong Luo <huisinro at yahoo.com>
>        *Date:* October 13, 2009 6:35:42 AM PDT
>        *To:* Shu Wu <superwushu at gmail.com>
>        *Subject:* *Re: [vbox-dev] VHD not readable by Hyper-V*
> 
>        No problem with vpc, vbox also understands vhds from hyper-v
> 
>        It is just that hyper-v doesn't understand vbox's vhd 
>        Sent from my iPhone
> 
>        On Oct 13, 2009, at 2:27 AM, Shu Wu <superwushu at gmail.com> wrote:
> 
>        Can your VHD disk be read by Virtual PC or Virtual Server? It
>        seems that Hyper-V and Virtual-PC share the same vhd format.
>        One year ago I wrote my own program to generate a vhd file
>        and make it to be accepted by Virtual PC, just following the
>        official vhd specification. But I haven't tested it on Hyper-V.
> 
>        Cheers,
> 
>        Wu Shu
> 
>        2009/10/13 Klaus Espenlaub <Klaus.Espenlaub at sun.com>
> 
>            Huihong Luo wrote:
> 
>                None of vbox created vhd disk files are readable by
>                2008 Hyper-V.
>                 This is the error: "The file or directory is
>                corrupted and unreadable"
>                 I am debugging through the code, trying to change
>                Footer info, such as version, creator OS, checksun,
>                etc., to see it can correct the error.
>                 If you know what might be wrong, pls post
> 
> 
>            We only know what Microsoft documents in their VHD format
>            spec, which we believe to have correctly implemented.
>            However as usual those specs are incomplete and not
>            really precise, so there's plenty of room for different
>            interpretations.
> 
>            Klaus




More information about the vbox-dev mailing list