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:
- Using the Windows installation disk, boot up your computer.
- When you are asked to select a language, select the appropriate language.
- Press Shift-F10 to launch a command console window.
- In the command window, issue the following commands (replace 60,000 with the
maximum size, in megabytes, for the VHD image):
- diskpart
- list disk
- sel disk 0
- create partition primary
- format fs=ntfs quick
- list vol
- assign
- list vol
- create vdisk file=C:\Windows7.vhd maximum=60000 type=expandable
- select vdisk file=C:\Windows7.vhd
- attach vdisk
- create partition primary
- format fs=ntfs quick
- assign letter=U:
- list vol
- list vdisk
- exit diskpart
- exit
- 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.
- 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.
- 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:
- Insert the Windows 7 DVD and boot up the computer using the DVD.
- As in the previous list, press Shift-F10 after selecting the language to display the command window.
- In the command window, issue the following commands:
- create vdisk file=C:\newWindows7.vhd maximum=60000 type=expandable
- select vdisk file=C:\newWindows7.vhd
- attach vdisk
- exit
- These commands create another VHD file (also of size 60 GB) in the primary partition of your drive.
- Exit the command prompt. Proceed to install Windows 7 as normal.
- 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.
- To change the description of each Windows instance, run the command prompt window as an Administrator.
- 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 {}).
- 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"
- Restart the computer; you should now see the updated description of each boot entries.
In this tutorial:
- Windows 7 Tips
- Customizing the UI
- Open a Command Window Anywhere
- Touch Gestures
- Taskbar Tips
- Taskbar Shortcuts
- Utilities/Troubleshooting Tools
- Troubleshooting Sleep Mode Problems
- Windows Disk Image Burner
- Windows 7 Compatibility Mode
- Installing Windows 7 Tips
- Performing a Clean Installation
- Performing an Upgrade Installation
- Upgrading Your Windows 7 Edition
- Installing Windows 7 Using a USB Thumb Drive
- Installing Windows 7 on a Virtual Hard Disk (VHD) File
- Managing the Boot Sector for Hard Disk Partitions
- Installing a Previous Version of Windows on a Computer Running Windows 7