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
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:
- Right-click on My Computer.
- Select Manage.
- In the left pane, under Storage, right-click on Disk Management.
- Select Create VHD.
- Choose a location (the physical drive where the VHD will reside).
- Enter an initial size for the VHD (again, I recommend 10Gb).
- 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.
- Click OK.
- Now the VHD exists as an uninitialized and unformatted drive on the system.
- 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.
- 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.
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):
- Boot your computer using the Windows 7 installation DVD.
- Select Repair Your Computer.
- Choose your existing primary operating system and click Next.
- 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):
- create vdisk file = c: vhd win7.vhd max = 10000
- select vdisk file = c: vhd win7.vhd
- attach vdisk
- Type setup.exe and hit Enter.
- Choose Custom installation.
- Select the VHD you just created as the destination for installing the operating system.
- 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.
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 firstname.lastname@example.org.
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 tonybradley.com.
This was first published in February 2010