Wednesday, April 6, 2011


Configuring a Virtual Hard Disk In Windows 7

Windows 7 has a new feature called “VHD Boot”. Using VHD, you can boot your entire Windows from a Virtual Hard Disk file (as those used with Virtual PC or Virtual Server). The advantages are significant as you only need to copy one file (the .VHD file) to a USB external drive and you’re entire system is included.

Also, one VHD file can be based on another one. So if you have different systems, create a base copy of Windows 7 on a VHD and make all others incremental. This allows you to save a lot of disk space!

Note though, there are a couple of disadvantages.

  • For starters, the .VHD booted operating system has to be Windows 7, Windows Server 2008 R2 or later.
  • Then there is also a degradation of performance. Some texts say only 3% but on the ones I created, it was more in the area of 20%. Really a noticeable difference. 
  • Windows hibernate function and most BitLocker configurations don’t work.
  • Also, if you like the really cool feature of Aero, they don’t work because the Windows Experience index won’t work.

Warning: BitLocker can be used within the guest VHD, but not on the volume where the VHD resides.

Booting VHD File With Virtual PC:

Note: I couldn’t find any texts on this, but I exchanged a physically booted VHD file with Virtual PC VHD files. All you need to do is run sysprep /generalize /oobe. Also the OS needs to be 32-Bit because of Virtual PC.

Installing a VHD-Boot Machine

1. Boot the system with a Windows 7 DVD or USB stick.

2. At the setup screen, don’t choose “Install Now”, but press “Shift-F10” to get into command line mode. Which is a cool little shortcut.

3. Enter diskpart to start the partitioning utitlity.

4. Create a new VHD file by entering the following:

create vdisk file=”D:\pathToVhd.vhd” type=expandable maximum=maxsizeInMegabyte

5. Now select the new VHD and attach it as a physical disk.

select vdisk file=”D:\pathToVhd.vhd”

6. After that switch back to the setup window (e.g. using ALT+TAB) and start the setup top attach a VDisk.

7. Now proceed with the normal setup, but make sure you install to the correct disk (normally the last one), ignore the “Windows cannot install to this disk” warning.

8. At next startup, you’ll see Windows 7 in the boot menu. If you want to add a VHD manually to the boot menu, use this command:

bcdedit /copy {originalguid} /d "New Windows 7 Installation"

bcdedit /set {newguid} device vhd=[D:]\Image.vhd

bcdedit /set {newguid} osdevice vhd=[D:]\Image.vhd

bcdedit /set {newguid} detecthal on

9. Right click on the My Computer icon in the Start Bar and choose Manage. If you are prompted from the UAC press Yes and continue.

10. To attach an existing VHD File In the left pane, right click on Disk Management, and click on Attach VHD as shown in Figure below.

You can also click on Disk Management, Action on the menu bar, and Attach VHD.

Configuring a Virtual Hard Disk In Windows 7 1

11. Click on the Browse button as shown in Figure below.

12. Navigate to the VHD file location and select it, then click on the Open button.

Configuring a Virtual Hard Disk In Windows 7 2

Note: If you want the VHD to be read-only, click the check the box, otherwise leave it unchecked. Click on OK.

If the existing VHD file is not created look at Creating a VHD in the next section.


About bench3 -

Haja Peer Mohamed H, Software Engineer by profession, Author, Founder and CEO of "bench3" you can connect with me on Twitter , Facebook and also onGoogle+

Subscribe to this Blog via Email :