The Boot To VHD feature in Windows 7 and Windows server 2008 R2 is a great way to turn a Virtual Hard Drive (vhd) created in Virtual PC (VPC) or Hyper-V into a boot partition. This allows you to take advantage of a bare metal boot scenario with the ease of use of a VHD for the partition.
To create a Boot To VHD system, you start with a VPC or Hyper-V generated VHD and run Sysprep on the Virtual Machine (VM) contained in the VHD. You then need to run some BCDEdit command lines against the VHD to register it as a boot device. See
http://joeblog.homnick.com/Lists/Posts/Post.aspx?ID=48 for a detail of executing these commands. This works on VHDs created with Windows 7.0 and Windows Server 2008 R2 operating systems. ** NOTE ** the VHD is expanded to its dynamic full size, so you need to allow for whatever size the VHD is set to dynamically expand to.
Something you lose with your VHD under Boot To VHD is that you can’t undo or rollback changes like you can in VPC/Hyper-V. Additionally, once you run BCDEdit on the VHD file, you can no longer use that VHD in Virtual PC/Hyper-V. You can work around this limitation through the use of a Differencing VHD.
Instead of running SysPrep and BCDEdit on the VHD that includes the base operating system and application programs, first create a Differencing VHD using the Virtual Disk Wizard in Virtual PC and New->Hard Disk Action in Hyper-V. This Differencing VHD is a fraction of the size of the Base VHD and can easily be swapped out for the equivalent of one-time undo/rollback. Additionally, the base vhd can still be run in Virtual PC or Hyper-V. If moving the base between Virtual PC and Hyper-V take into consideration possibly uninstalling the virtual machine additions.
To recap, here is a step by step to create a Boot To VHD
scenario which takes into account a flexible differencing disk approach that mitigates the loss of VHD access options and provides for a simple rollback.
1. Create Base VHD in Virtual PC (2007 or Windows 7), Hyper-V or batch file build
2. Install application programs (Office, Visual Studio, SQL Server, etc.)
3. Exit virtual machine
4. Make the Base VHD Read-only.
5. Create a Differencing VHD linked to the Base VHD using Virtual Disk Wizard in Virtual PC or New->Hard Disk Action in Hyper-V
6. Launch a virtual machine based upon the differencing disk and runs sysprep.exe found in \windows\system32\sysprep . Take the OOBE, Generalize and Shut Down options.
7. Backup/Copy the Differencing VHD.
8. Run the BCDEdit commend line utility against the Differencing VHD , see
http://joeblog.homnick.com/Lists/Posts/Post.aspx?ID=489. Backup/Copy the Differencing VHD.
This creates a scenario where you can easily transfer between systems the VHDs, regardless of using them in Virtual PC, Hyper-V or Boot To VHD scenarios. Remember that you can always back up the Differencing VHD at any point to create a point in time Snapshot of your Boot To VHD operationg system.