At this semesters TechNet Events we are helping customers configure their machines with Boot From VHD images for Windows Server 2008R2 and Server “8” Beta. I have put together this page to help in troubleshooting a Boot From VHD environment.

Here are the instructions we handed out at the event for configuring Boot From VHD:

To setup Boot From VHD on Windows Visa or above. Copy the files to the root of your C: drive

c:\BootVHD\
c:\BootVHD\AutoBootVHD.bat
c:\BootVHD\win8beta.vhd

From a Command Prompt(With Administrative access) type:

  • AutoBootVHD-BCD C:\bootvhd\win8beta.vhd Windows_8_Beta -d
    (AutoBootVHD-BCD.bat <VHD file location>  <Menu Name For Boot List> <-d optional make default item>)

Here are a few of the lessons I learned in troubleshooting Boot From VHD problems:

1. Make a back up of your boot database before you mess with it.
From a Command Prompt(With Administrative access) type:
  • BCDEDIT /export c:\bcdbackup.bak
    (Creates a backup so if you need to restore you can by typing: BCDEDIT /import c:\bcdbackup.bak)
2.

If your machine just boots into a Windows Recovery session instead of the Boot to VHD you need to update your boot files. I saw this most when using Windows “8” beta or CP in a VHD with a Windows 7 host. Here is how you fix it.
First Attach the VHD as a drive letter. In this example I will attach it as drive D:

Start a Command Prompt with Administrative access and type the following commands:

  1. diskpart.exe – starts the diskpart tool
  2. select vdisk file=c:\bootvhd\win8beta.vhd – this selects the vhd file for the next command
  3. attach vdisk – The vhd will be mounted as a disk.
  4. Exit
  5. BCDBOOT D:\windows – where “D:” is the drive assigned to the attached VHD file. After this finishes you can restart and boot into your VHD.
3.

If you are experiencing a Blue Screen of Death (BSOD) when booting your VHD.
This was usually caused by a lack of disk space on the drive containing the VHD file. For the VHDs I provided make sure you have 40 gig of free disk space because the dynamically expanding VHD is a 40 Gig disk and there must be enough free space on the disk to support filling this drive when it boots. If you made your own you want to have a much space free as it needs to fill the VHD. One way to avoid this issue is to use a fixed size VHD.

4. To remove: Boot to an OS you are keeping and delete the VHD file. Run MSconfig.exe and on the Boot tab just delete the entry.
5. If you boot into the host OS you can replace the vhd with another vhd with the same name and it will then boot off of that VHD file. As long as the Windows install is in the same folder. I use this similar to the way I a snapshot in Hyper-v.
6. You can not use USB drives to store your VHD file. It has to be a local disk.
7. Disk encryption causes problems for Boot from VHD. I do have a machine with the C: drive bitlockered and my vhd on the D: drive. Remember to suspend bitlocker whenever changing the boot menu environment or you will need the recovery key.