For quite a while, Microsoft has provided Windows XP Mode as a means for installing alternate operating systems...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
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:
- 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.
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):
- 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.
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 email@example.com.
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.