What is a native VHD boot?....This means that a VHD can be used as the running operating system on designated hardware without a parent operating system, virtual machine, or hypervisor. Furthermore, if you use native boot, you have full access to all devices and file system volumes on the physical computer, including the volumes inside the VHD. In contrast, when Windows runs in a virtual machine, only one file system volume in the virtual disk (volume C:) is available to guest machines (unless you share another volume to the virtual machine).
Before proceeding it should be stated that only limited versions of Windows actually support Native VHD Boot. At the time of writing these include -
- Windows 8 Consumer Preview
- Windows 7 Enterprise
- Windows 7 Ultimate
- Windows Server 2008 R2
There are three different types of Virtual Hard Disks - fixed, expanding and differencing. A fixed disk is similar to a RAW disk image, but contains a header and footer. Fixed disks have a specified size which will not change when data is written to a mounted image - a 10 GB fixed disk will consequently always be 10 GB on the host file system, regardless of the amount of unused space within it. Fixed disks are recommended by Microsoft in production environments.
An expanding disk will dynamically increase in size as data is written to it, up to the maximum size limit specified when it was created. Unlike a fixed disk it will not contain any unused space and consequently takes up considerably less space on the host file system. Expanding disks are recommended by Microsoft for use in nonproduction (e.g. test) environments.
Differencing Type Virtual Hard Disks
Differencing disk are more complex than either expanding or fixed type VHDs. A differencing disk (sometimes referred to as a Child) is always linked to a Parent disk. This link is hard-coded into the differencing VHD - if the link is broken (e.g. the Parent disk is renamed or moved) then the differencing disk cannot be booted or mounted to retrieve data. The underlying Parent Disk can be a fixed or expanding type disk. Another differencing disk can also be used as Parent, creating a chain of differencing disks. When a differencing disk is created, its size is not specified as it will always have the same maximum size as the underlying Parent disk - or the base disk in a chain of differencing disks.
For details on creating a Parent disk refer to the Recommended Reading section below.
A differencing disk only contains changes made from the base (Parent) image - "it contains only the modified disk blocks of the associated parent VHD". In practice it's not dissimilar to using Microsoft's Enhanced Write Filter - with all write requests being redirected from the Parent to the differencing image. A differencing disk is always a dynamically expanding type file, even when its Parent is a fixed type disk.
Assuming a differencing disk has been created from a Parent disk containing a Windows Operating System - when the differencing disk is mounted offline (not booted) all of the files contained in the parent will be accessible. Any files that are injected into the mounted differencing disk will only be saved in the differencing disk - the underlying Parent image will remain unchanged. This includes offline registry edits.
These same principles apply when the differencing disk is used for Native Booting. Any changes that are made to the operating system when the differencing disk is booted (e.g. an application is installed) will only be saved in the differencing image - the Parent image remains unchanged.
Interestingly, when a differencing disk is mounted offline its size on the host file system remains unchanged. In a test I ran, the differencing image was 912MB before being mounted and remained 912MB after being mounted - until data was written to it. The same differencing disk, when booted, was shown as being expanded to it's maximum size on the host file system - 15GB for the file I used in these tests.
Creating DIfferencing Disks
To create a differencing disk, start DiskPart (the easiest method is to open a Run command box/window and type diskpart [ENTER])
In diskpart, use the following command syntax to create a differencing disk -
create vdisk file=PATH_TO_DIFFERENCING_IMAGE parent=PATH_TO_PARENT_IMAGEE.g.
create vdisk file=C:\Differencing.vhd parent=C:\Parent.vhd
That's it. Well done!
WARNING
Please take note of the following (from Frequently Asked Questions: Virtual Hard Disks in Windows 7 and Windows Server 2008 R2) -
You should not modify the parent of a differencing VHD. If the parent VHD is changed or replaced by a different VHD (even if it has the same file name), the block structure between the parent and differencing VHD will no longer match and the differencing VHD will be corrupted.
To reiterate - DO NOT BOOT FROM, OR EDIT, THE PARENT DISK. If any changes are made to a Parent disk, then any differencing (child) disks are unlikely to boot.
Repairing a Link to a Parent Disk
See post number 2
Differencing Disk Limitations
Refer to the linked documents in the Recommended Reading section below for a more detailed list of Native VHD Boot limitations.
Boot files (including bootmgr and the BCD store) and the pagefile are not stored in the Virtual Hard Disk and must remain on the host file system - the VHD is therefore not completely self contained and if it is moved to a new system then new boot files will need to be created.
Hibernation is not supported, however sleep mode is.
Expanding and differencing type disks are expanded to their maximum size when booted - the host volume must therefore be large enough to contain the expanded disk.
According to Frequently Asked Questions: Virtual Hard Disks in Windows 7 and Windows Server 2008 R2 -
During my tests booting Windows 8 Consumer Preview from a differencing VHD I was able to boot a differencing disk whose Parent disk was in a different directory. It would not boot when the Parent disk was moved to another volume on the same physical disk - in fact the menu entry disappeared from the boot menu after the parent disk was moved.You must keep both files (the parent VHD and the differencing VHD) in the same directory on a local volume for native-boot scenarios. For native-boot VHDs, the parent VHD and the differencing disk cannot reside on different volumes, even if they reside on the same local disk. However, when you attach a differencing VHD that is not used for native boot (for example, if you plan to use it for image management), the parent VHD can be in different directories, and on a different volume or even on a remote share.
Recommended Reading
Frequently Asked Questions: Virtual Hard Disks in Windows 7 and Windows Server 2008 R2 - Includes the following; What is a native VHD boot?, What are the different VHD file types?, Why are fixed VHDs recommended for production?, When is it appropriate to use dynamically expanding VHDs?, What does it mean to create, attach, and detach VHDs?, Are there any restrictions that I should be aware of when attaching VHDs?, What are the recommendations for using VHDs for native boot?, What is not supported for native boot when using VHDs?
Understanding Virtual Hard Disks with Native Boot - Includes detailed information on the following topics; What Is VHD with Native Boot?, Common Scenarios, Requirements, Benefits, Limitations, Recommendations, Types of Virtual Hard Disks, Technologies Related to VHDs with Native Boot
Native Boot VHD - Forum thread by diddy. Sadly a lot of information in this thread appears to have been lost in one of the board updates.
Create Native Boot VHDs - Forum thread by sambul61. Contains one method for creating a Native VHD Boot base image.
System & Differencing VHDs synch and update strategy - Post by sha0. Contains interesting suggestions on how he might use a chain of differencing images for a Native VHD Boot setup.
VHD Based Windows To Go - Post by me. Contains a walkthrough for creating a Native VHD Boot base image using a Windows 8 Consumer Preview installer. It might need adapting as it's focused on creating a VHD installation on a USB hard disk.
Regards,
Misty