Ever since I heard that Windows 7 was going to support “Boot from VHD” I wanted to give it a try. With promises like:
- The flexibility of Virtual PC in that the drive is a file so backup and moving it around is greatly simplified
- Speed increase because the OS is “Running on the Tin”
- Flexibility of existing multiple boot but without requiring any special partitioning of the machine’s drives
- Ability to use “most” of the existing hardware including USB
In my case, I wanted to work through all of the requirements and potential issues around installing the full Team Foundation Server 2010 environment. Using the VHD approach, I could use almost all of the potential speed of my machine but as I was working through each step of the installation, I could stop and backup the vhd file at each step of “success”. This way, if any less than successful results happened after the last backup, I could restore the last good version simply by copying a file. I took major advantage of this ability as I attempted various install options.
Anyway, it all sounded great and in addition to the above, I have additional reasons for needing the capability. I don’t want to have to carry multiple machines with me on the job and I don’t want to have to put up with the performance degradation or using all of my machines resources to run multiple OS’s in a Virtual PC approach. I started doing research around how to get things properly in place to make it happen and I was initially confused with the multiple ways to potentially make things happen. You can create the image while booting from a DVD, run a combination of commands from DiskPart and BCDEdit and ImageX and so forth. Personally, I wanted something simple and reliable – something that closely mimicked what I would normally do on a fresh machine. The following is just one way to make “Boot from VHD” happen but it works and is pretty simple to do.
System Requirements:
- Host machine needs to be Windows 7 (Enterprise or Ultimate)
- The new VHD OS must be Windows 7 (Enterprise or Ultimate) or Windows Server 2008 R2
Note: I’ve read about some potential tricks to fool the system into allowing OS’s other than Win7 and W2K8 R2 but I haven’t tried them nor are they a supported option.
I started with a 64 bit dual-proc laptop. I do a LOT of work with Team Foundation Server and as I stated above, I wanted to load the new beta bits. TFS needs to be loaded on a server so Windows Server 2008 R2 was the logical option for the new VHD operating system (luckily, I am working with a 64 bit laptop since R2 is only 64 bit).
The following are the major steps I went through to make this happen:
- Started with my laptop running Windows 7
- Created a Windows Server 2008 R2 boot DVD
- Booted the machine with the R2 Server DVD
- Create the virtual hard drive and attach it through a CMD window and the Diskpart utility
- Continue to use the standard installation process via the DVD
- Select the appropriate disk to load the W2K8 R2 OS
- Continue installing as normal
- Reboot into Win7 OS
- Set boot priorities and descriptions using BCDEdit and MSConfig
Here are the steps in detail:
1. Boot a Windows 7 machine using a DVD. I used Windows Server 2008 R2 (W2K8 R2)
2. When the initial installation window appears to install W2K8 R2, press SHIFT-F10 to bring up a command (CMD) window. In the command window, execute the “diskpart” utility application. Through this utility we can create a virtual hard drive (VHD) file and attach it to the current OS so the installation can see it. Below are the commands to run within DiskPart:
CREATE VDISK FILE=”insert the full path file name here” MAXIMUM=##### TYPE=[FIXED | EXPANDABLE]
In my case, I put the VHD in a folder on my D: drive, set the maximum size to 64000 (64 GB) and made it expandable. I am willing to take the risk and performance reduction in return for not taking up the full 64 GB on my disk right away.
Note: the VHD file should not exist before this command is issued but if a sub-folder is to be used, that sub-folder must exist. The “MAXIMUM” parameter identifies how large the virtual disk is to be. This size number is in megabytes. The TYPE parameter indicates whether the disk is to be created at its full size or if it is to grow over time up to its full size. FIXED will provide higher performance but requires the full size allocation to be created from the start. EXPANDABLE is somewhat less performant but does not require the full space allocation – it will grow over time. One potential issue is that if the physical disk becomes full and the expandable VHD attempts to grow, there will be a write error and the results are unpredictable.
SELECT VDISK FILE=”same path as above”
ATTACH VDISK
CREATE PARTITION PRIMARY
ASSIGN
FORMAT QUICK LABEL=YourVolLabel
EXIT
Note: These steps will create the VHD file, attach the “disk” to the system, create the primary partition, assign a drive letter and format the new drive. It will now be available to the W2K8 R2 installation process.

3. Exit out of the CMD window
4. Continue on with the installation.
5. Select the “flavor” of OS to install.
6. Select “Custom” rather than “Upgrade”. This will install the full “new” operating system to the partition.
7. A few screens later you will be able to select the partition to install the new operating system into. You will be able to identify the appropriate partition by a couple indicators. It should be the last partition in the list. It will contain the volume label that you used in the “diskpart” commands (I used “W2K8R2Tst” as shown below). Finally, the size of the partition could be an additional indicator. Select the new partition and click “Next”.
8. After that, continue with the install as normal.
9. The last thing to do is just some cleanup. When the install is complete, reboot the machine into the original Win7 OS. Even though you log in under your ID, it may boot up using an alternative profile and your desktop may not look as it should. If this is the case, do the following:
- Click on the start marble
- Enter “msconfig”
- Select the boot tab
- Select the Windows 7 “Current OS” line. It should be the last line.
- Click “Set as default”
- Click “OK”
This will do a couple things. It will set your machine’s Win7 OS as the default so when the multiple boot screen comes up, it will automatically select Win7. It also seems to get rid of the alternate profile issue so when you reboot, your regular desktop will appear.
10. This step is completely optional but if you want to define your own description to the boot selection rather than the default then using BCDEdit gives you the ability to change the default descriptions. This helps when you have more than one possible boot VHD’s that use the same OS. Instead of having to guess which “Windows Server 2008 R2” to boot up with, you can be sure with different descriptions.
- Open a Command window with elevated privileges.
- Click on the Start Marble
- Type “CMD”
- Right-click “cmd.exe” in the resulting list
- Select “Run as Administrator”
- The command window should appear
- Type “BCDEDIT”. This will display the boot list.
- Look for the newly created boot record. It can be identified by reviewing the value next to the “device” parameter.
- Directly above “device” is the “identifier” GUID that you need to use in the BCDEdit command syntax
- Copy the GUID including the curly brackets
- Type: BCDEDIT /set {YOUR GUID} description “YOUR NEW DESCRIPTION”
- Hit Enter
This will change the description as shown below:
As you can see, the descriptions are now changed. These are the values that you will see when the machine initially boots up and the multiple boot options appear. By the way, MSConfig also allows you to delete the boot option from your machine by selecting the one that you want to delete and then clicking the “Delete” button just below the boot list.
That’s it. You should be about to follow these steps to install a Windows Server 2008 R2 or additional Windows 7 VHD giving you multiple boot capabilities.