Manage Learn to apply best practices and optimize your operations.

The value of booting from a VHD in Windows 7

Booting a system from a virtual hard drive is one of the perks of Windows 7. After reviewing the security benefits, Tony Bradley offers a step-by-step plan for creating a VHD.

For quite a while, Microsoft has provided Windows XP Mode as a means for installing alternate operating systems for testing purposes. With Windows 7, though, Microsoft embraces virtualization in a greater way, offering the ability to work natively with virtual hard disk (VHD) drives. Using the latest Microsoft OS, you can actually boot the system from a VHD. In this tip, we'll look at the benefits of the feature and review how to create a virtual hard disk.

How to create a VHD in Windows 7

First, let's take a look at creating a VHD in Windows 7. Make sure you have sufficient space available on a physical drive on your system -- I recommend a minimum of 10 GB. I also advise that you back up your data as a precaution before performing these steps. Once you are ready, do the following:

  1. Right-click on My Computer.
  2. Select Manage.
  3. In the left pane, under Storage, right-click on Disk Management.
  4. Select Create VHD.
  5. Choose a location (the physical drive where the VHD will reside).
  6. Enter an initial size for the VHD (again, I recommend 10Gb).
  7. Select either Dynamic or Fixed. Fixed sets the VHD to the size specified above, while Dynamic uses only the space it needs -- up to the maximum size specified above.
  8. Click OK.
  9. Now the VHD exists as an uninitialized and unformatted drive on the system.
  10. Right click on the VHD in the Disk Management pane and click on Initialize Disk. Unless you have a specific reason to use GPT, leave the selection on MBR and click OK.
  11. Now that it is initialized, you can format it. Right-click on the drive and select New Simple Volume and proceed to format the drive as you would any physical hard disk.

A note on encryption

You should not use EFS (Encrypting File System) to encrypt VHD files or the folders they are stored in. Virtual PC is unable to work with EFS-encrypted files. If you have the right version of Windows 7 (Ultimate or Enterprise editions, or Windows Server 2008), however, you can encrypt your drive using BitLocker, which will also encrypt and protect the VHDs stored on it.

When mounted as a drive, you can encrypt the VHD file using BitLocker, and because it is viewed as a single file, it will retain its encryption even if copied in plain-text to removable media for backup or transportation purposes. Encrypting VHDs in this way, however, relies on unlocking the BitLocker encryption on the primary operating system drive. You also will not be able to boot from a BitLocker-encrypted VHD. Until the primary operating system is logged in, the secondary volumes remain protected by encryption and the system won't be able to read the VHD.

Creating and using a VHD provides simplified backup and portability. You could create a 10 GB partition on your physical drive and store data there, but you would have to use other tools to back it up and restore it, or copy all of the data to some other media. A VHD is simply a file stored on your hard drive in the folder that you designate. With a virtual hard drive file, you can simply copy the VHD for backup purposes, and you can move or share the data by simply copying the VHD to another system and attaching it.

Booting from a VHD

You can also boot an alternate operating system from VHD, the advantage being that you get the benefits of both dual boot and virtualization together. The VHD operates in a virtual environment that will not impact your primary operating system. Also, because it runs from boot rather than virtualized within the primary operating system, it doesn't have to share system resources.

The ability to boot from VHD provides a number of benefits. It enables organizations to work with and test various operating system environments from a single hardware platform. By reserving a base copy of each operating system VHD, developers can work freely with each environment without concern for the changes being made; the original VHD is still available to provide a clean slate.

Testing any operating system configuration changes or new applications should be done in a virtual environment to prevent any impact or adverse effects on the primary or production operating system.

On the one hand, the VHD provides more security because any malware compromises or data breaches that might occur will only affect the virtual operating system. It is worth noting, however, that the VHD environment must be updated and protected just like any other operating system if you want to secure it and ensure it does not become infected or compromised.

To install Windows 7 to boot from a VHD, follow these steps (again, make sure you back up your system and have sufficient free space on your physical drive first):

  1. Boot your computer using the Windows 7 installation DVD.
  2. Select Repair Your Computer.
  3. Choose your existing primary operating system and click Next.
  4. Click on Command Prompt and issue the following commands (change C: to whatever physical drive and path you want to create the VHD on, and set the max size to the number of megabytes you wish):
  5. create vdisk file = c: vhd win7.vhd max = 10000
  6. select vdisk file = c: vhd win7.vhd
  7. attach vdisk
  8. exit
  9. Type setup.exe and hit Enter.
  10. Choose Custom installation.
  11. Select the VHD you just created as the destination for installing the operating system.
  12. Proceed to install Windows 7 just as you would on any physical drive.

Between Windows XP Mode and the ability to work with and boot from VHDs, Windows 7 takes virtualization to a new level and makes it a much more mainstream tool for your computing needs.

More Windows 7 resource

Tony Bradley explains how to use Windows XP Mode virtualization in Windows 7.

Windows Firewall with Advanced Security extends security to Windows 7 and Windows Server 2008 end users.

Virtual computing is generally seen as a drain on system resources, and reserved for uber geeks, but Windows 7 speeds up virtual computing significantly, and booting to a VHD means not having to share system resources at all. Average users can now benefit from the ability to work with multiple operating systems, or create a sandbox operating system for testing purposes using the VHD capabilities in Windows 7.

Send comments on this technical tip

Join our IT Knowledge Exchange discussion forum; please use the midmarket security tag.

About the Author

Tony Bradley, 'chief' technical evangelist for Zecurion, is a CISSP and 4-time Microsoft MVP. He tweets as @PCSecurityNews and provides tips, advice, and reviews on information security and unified communications technologies on his site at

Dig Deeper on Security vulnerability management

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.