<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    I've documented a reproducible case where Windows sees large disks
    (over 2TB) as the total disk size minus 2TB. When I use 'VBoxManage
    storageattach ...' to add the disk to a running Windows VM, this
    causes Windows to decide that the backup GPT header is missing, so
    it writes a new backup header at the location that it thinks is the
    end of the disk (2^32 sectors from the end of the disk); this
    corrupts whatever file is at that location. This occurs in any
    version of Windows that's running the NT5 kernel and has GPT
    support, which includes Windows 2003 SP1 and later along with
    Windows XP x64 Edition.<br>
    <br>
    I have verified that the corruption occurs only when the disk is
    attached to a SATA controller on the VM, and the same corruption
    occurs using KVM as the virtualization platform; it does not occur
    on a physical system (based on a Gigabyte GA-D525TUD motherboard,
    which has the NM10 Express chipset - I do not have access to any
    ICH8 or ICH9 physical systems). It does not occur if you boot the
    same VM using a Linux LiveCD ISO image, which leads me to believe
    that it's a bug in either Microsoft's Windows SATA code or Intel's
    SATA controller driver that only manifests itself when virtualized.<br>
    <br>
    Aside from the incorrect sizing and GPT header/data corruption,
    something is preventing the Windows bootloader from loading if the
    large volume is attached to the VM before booting. If you attempt to
    boot the machine with a large (>2TB) volume attached to a SATA or
    SCSI controller, it freezes at a black screen with no cursor. If I
    create an unpartitioned, empty raw disk and attach it to a SCSI
    controller on the VM, Windows is able to boot and then I can use
    Disk Management to partition and format its full capacity. However,
    once I shut down (or reboot) the machine, it will no longer boot,
    freezing at a black screen with no cursor just the same as when
    attaching the volume to the SATA controller.<br>
    <br>
    I had a brief discussion with Klaus in #vbox on Freenode, during
    which I reproduced the bug as follows:<br>
    largevolume-vbox13.vmdk is a text header file with no data, pointing
    to largevolume-vbox13.raw; see its contents here:
    <a class="moz-txt-link-freetext" href="http://paste.ubuntu.com/1071285/">http://paste.ubuntu.com/1071285/</a><br>
    <br>
    largevolume-vbox13.raw is a 2726162350592 byte (approximately
    2.5TiB) GPT partitioned with a single NTFS partition; see its
    partition table throughout the tests here:
    <a class="moz-txt-link-freetext" href="http://paste.ubuntu.com/1071279/">http://paste.ubuntu.com/1071279/</a><br>
    <br>
    First boot: In the VirtualBox GUI, I attached
    largevolume-vbox13.vmdk to port 1 of the virtual machine's SATA
    controller. The machine freezes at a black screen with no cursor,
    shortly after the VirtualBox BIOS splash screen. See the VBox.log
    file for this boot here: <a class="moz-txt-link-freetext" href="http://paste.ubuntu.com/1071275/">http://paste.ubuntu.com/1071275/</a><br>
    <br>
    Second boot: Windows was booted without largevolume-vbox13.vmdk
    attached, then it was attached to the VM once Windows had reached
    the GUI and I logged in. As soon as the disk becomes visible in Disk
    Management, the partition table gets corrupted, as can be seen in
    the partition tables pastebin (<a class="moz-txt-link-freetext" href="http://paste.ubuntu.com/1071279/">http://paste.ubuntu.com/1071279/</a>).
    See the VBox.log for this boot here:
    <a class="moz-txt-link-freetext" href="http://paste.ubuntu.com/1071276/">http://paste.ubuntu.com/1071276/</a><br>
    <br>
    Third boot: I created an unpartitioned raw disk image and VMDK as
    documented in the last entry in the partition table pastebin
    (<a class="moz-txt-link-freetext" href="http://paste.ubuntu.com/1071279/">http://paste.ubuntu.com/1071279/</a>). Windows recognized the disk as a
    490.9GiB drive and partitioned it accordingly (as an MBR disk) when
    I followed the new disk initialization wizard. See the VBox.log for
    this boot here: <a class="moz-txt-link-freetext" href="http://paste.ubuntu.com/1071277/">http://paste.ubuntu.com/1071277/</a><br>
    <br>
    In this screenshot, I had booted the Windows VM, then attached the
    drive to a port on its SATA controller; notice that Disk Management
    is showing the correct volume size (2538.94GB), wmic is showing the
    incorrect size for the volume (527133519360 bytes), and gdisk is
    showing an incorrect total volume size (490.9GiB) and the correct
    partition size (2.5TiB). <a class="moz-txt-link-freetext" href="http://imagebin.org/219211">http://imagebin.org/219211</a><br>
    <br>
    The same situation in KVM: <a class="moz-txt-link-freetext" href="http://imagebin.org/217124">http://imagebin.org/217124</a><br>
    <br>
    The data corruption issue is causing serious problems for me, and
    using the SCSI controller could be a workaround if it supported
    hotplugging.<br>
    <br>
    Some additional reading:<br>
    Mentions a situation in which Windows can hit a black screen with no
    cursor while booting:<br>
<a class="moz-txt-link-freetext" href="http://blogs.msdn.com/b/ntdebugging/archive/2007/06/19/how-windows-starts-up-part-1-of-4.aspx">http://blogs.msdn.com/b/ntdebugging/archive/2007/06/19/how-windows-starts-up-part-1-of-4.aspx</a><br>
    <br>
    Talks about storage drivers incorrectly accessing disks larger than
    2TB:<br>
    <a class="moz-txt-link-freetext" href="http://support.microsoft.com/kb/2581408">http://support.microsoft.com/kb/2581408</a><br>
    <br>
    A discussion in which a 2TB limit on ICH8 is discussed, although
    it's only mentioned specifically in the context of the controller's
    RAID mode:<br>
    <a class="moz-txt-link-freetext" href="http://www.tomshardware.com/forum/page-216247_30_50.html">http://www.tomshardware.com/forum/page-216247_30_50.html</a><br>
    <br>
    Thanks in advance...<br>
    <br>
    Matt<br>
    <br>
    <div class="moz-signature">
      -- <br>
      <b>Matthew Coleman</b>
      <br>
      Developer :: Datto Inc. :: <a class="moz-txt-link-abbreviated" href="http://www.dattobackup.com">www.dattobackup.com</a> :: (203) 710-4470</div>
  </body>
</html>