Windows 7 / Getting Started

Installing Windows 7 on a Virtual Hard Disk (VHD) File

Virtual machine technologies have been around for quite some time, and Microsoft is a strong proponent of this technology, with products like Virtual PC and Virtual Server. Using virtual machines, the operating system is installed on a virtual hard disk and the operating system runs on an emulated hardware environment. However, the key limitation of virtual machines is that they cannot leverage all the hardware available on the system, such as graphics, wireless, USB, and so on.

In Windows 7, the Virtual Hard Disk that is used by Virtual PC (and other virtualization products) is now natively supported. This means that you can now install the entire operating system on a single VHD file and boot the computer off the single VHD file. This allows the operating system to run natively on the hardware (and not on emulation) and makes it very easy for administrators and developers to test different configurations of systems.

The following steps will show you how to install Windows 7 on a VHD file using a new fresh hard disk:

  1. Using the Windows installation disk, boot up your computer.
  2. When you are asked to select a language, select the appropriate language.
  3. Press Shift-F10 to launch a command console window.
  4. In the command window, issue the following commands (replace 60,000 with the maximum size, in megabytes, for the VHD image):
    1. diskpart
    2. list disk
    3. sel disk 0
    4. create partition primary
    5. format fs=ntfs quick
    6. list vol
    7. assign
    8. list vol
    9. create vdisk file=C:\Windows7.vhd maximum=60000 type=expandable
    10. select vdisk file=C:\Windows7.vhd
    11. attach vdisk
    12. create partition primary
    13. format fs=ntfs quick
    14. assign letter=U:
    15. list vol
    16. list vdisk
    17. exit diskpart
    18. exit
  5. These commands first create a primary partition on your hard disk and then create a new VHD file (of size 60 GB) in the primary partition.
  6. Continue with the installation of Windows 7. You will now have created a VHD file on your drive, which looks like a normal partition to the Windows 7 installer. Select Disk 1 Partition 1 to install Windows 7 (ignore the error message displayed at the bottom of the window). Click Next.
  7. Following the instructions on the screen to complete the installation of Windows 7.

When Windows 7 is installed on the computer's hard disk, you can now proceed to install another operating system on the hard disk using a VHD file. The following steps show how to install another copy of the Windows 7 operating system using a VHD file:

  1. Insert the Windows 7 DVD and boot up the computer using the DVD.
  2. As in the previous list, press Shift-F10 after selecting the language to display the command window.
  3. In the command window, issue the following commands:
    1. create vdisk file=C:\newWindows7.vhd maximum=60000 type=expandable
    2. select vdisk file=C:\newWindows7.vhd
    3. attach vdisk
    4. exit
  4. These commands create another VHD file (also of size 60 GB) in the primary partition of your drive.
  5. Exit the command prompt. Proceed to install Windows 7 as normal.
  6. Once the installation is done, you will see two copies of Windows 7 in the boot loader when the computer restarts. Select an instance to boot up.
  7. To change the description of each Windows instance, run the command prompt window as an Administrator.
  8. In the command window, type bcdedit /v. This will display the entries in the boot manager. Observe the identifiers of each boot entry (those enclosed by the {}).
  9. Enter the following command to change the description of the each entry in the boot manager (where {xxx} is the identifier of the boot entry you want to change):
    bcdedit /set {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} description "Windows 7 VHD"
  10. Restart the computer; you should now see the updated description of each boot entries.
[Previous] [Contents] [Next]