Why I Love My Virtual PCs

Saturday, February 7, 2004

When Virtual PC appeared on the download list for MSDN Universal Subscribers I knew this was going to be a hit with developers. It had been about 2 years since I had used VMWare, and it suddenly hit me how useful this product would for everyday work in development, testing, and exploring.

A Virtual PC creates a computer (a virtual pc) inside of your computer (known as the host). The Virtual PC has a network adaptor, a sound card, a video adaptor, and even it’s own BIOS settings – all implemented in software. The changes you make to a virtual PC do not change anything on the host computer. You can install operating systems on the virtual computer without partitioning any of your hard drives. You can run multiple virtual PCs, turn them on, reboot them, and suspend them, all while continuing to read email and play audio files on your host. You can install software on a Virtual PC and keep an “Undo” disk to roll back changes afterwards. This creates a great environment for software testing and tinkering.

Practical Advice

Robert Moir maintains a Virtual PC 2004 FAQ. This FAQ includes tips, tricks, and hints, as well as a list of known issues and security best practices.

Johnathan Maltz keeps a list of OS’s which work and don’t work in VPC 2004 (as Johnathan points out, the list of operating systems which work with VPC is vastly greater than the list of operating systems which Microsoft officially supports on VPC). Systems which do not work are the exception, not the rule. I have VPCs running Windows 2000 Server, Windows Server 2003 Web Server Edition, Longhorn (PDC Build), and Mandrake Linux.

Pretty much anything that can run on an x86 system should run on VPC. I’ve booted Damn Small Linux, which comes as a 50MB bootable CD image (so it can fit on a jump drive). Damn Small Linux includes a web browser, FTP client, windows manager, spellcheck, rdesktop, and a whole host of other stuff.

Performance & Requirements

Robert’s FAQ has a number of tips about better performance in VPC 2004. 

If you are curious as to the hard disk requirements, here is a listing of some virtual pc images.

Roughly 34 GB of space used across 9 virtual PCs, with the largest being a Longhorn install with the Longhorn SDK and Whidbey preview. The smallest footprint comes from Windows Server 2003 Web Edition.

A Quick Walkthrough Install

Every operating system setup is different, but we will walk through setting up a new and assume you have a bootable CD or bootable CD image to install from.

Once you have VPC installed you can launch the Virtual PC console from the start menu.

Click on the New button to launch the wizard. On the Options dialog click “Create a virtual machine”. Give the machine a name, and a location to store the VMC file. (VMC files are small XML files with the configuration information, take a look at one in Notepad).

On the Operating System Dialog, select the operating system that most closely matches the OS you plan to install. On the memory dialog, you’ll need to decide how much RAM to give the VPC. Hopefully you can fulfill the minimum requirements of the guest OS.

On the next screen, “Virtual Hard Disk Options”, you can create a new .vhd file for the VPC, or select an existing file. This is where VPC gets interesting, as this file will represent a hard disk drive in the Virtual PC. Select the new file option for your first Virtual PC, then click finish.

You new virtual PC is ready to start from the VPC console. When started you should see a boot screen like the following.

If you have a bootable CD, go to the “CD” menu in the host window and select “Use Physical Drive X:”, where X is the drive letter of the host CD-ROM. The virtual PC CDROM will now attach to the CD in the drive. For an ISO image, select “Capture ISO image…” and browse to the file.

At this point you are now on your way to installing an operating system on your PC. You can partition and format the virtual hard drive as much as you want – don’t worry it will not harm the host drive.

Once you have an operating system installed, with patches installed and updated applied, you may want to make a copy of the vhd file VPC created. This allows you to create additional Virtual PCs without the effort you expended getting to this point.

When I want to try some new software on a fresh machine, I copy a file I named Win2000SP4.NET.VHD. This contains a copy of Windows 2000 with SP4 applied. I upgraded IE to 6.0 SP1 and installed the .NET framework. Instead of doing this all over again from scratch, I make a copy of Win2000SP4.NET.VHD to another file, then create a new virtual PC in the wizard and attach it to this new file.

Undo

Another slick feature in Virtual PC is the undo drive. This feature is indispensable for testing software installations, because you can roll a virtual machine back to a pristine state to test installation options on a fresh computer. To start the Undo feature, shut down your virtual PC, go to the virtual PC console, highlight the PC and select settings. In the following dialog, click the “Enable Undo Disks” checkbox.

With Undo in place, changes to the guest virtual hard drive are stored in .vud files. When you shut down the virtual PC window, you are given the option of discarding or saving the changes. If you choose to discard the changes the next time the virtual PC boots it will be just as if you had never made any changes to the system. You can also save the changes, shut down the computer, but still not commit the changes. This will allow you to keep working with the virtual PC with an opportunity to roll back to the previous state. Finally, you can shut down and apply all the changes you have made to this point.

Support

Microsoft has added the Virtual PC 2004 support center. Take a look to see the latest knowledge base articles and step by step how-tos.

Conclusion

This article takes a very brief look at Microsoft Virtual PC 2004. If you don’t use a virtualization product today, chances are you will soon. Gartner declared 2004 as the year of virtualization, and additional technologies and products are rolling out in this space (Microsoft is planning a release of Virtual Server later this year).

More resources:

An Introduction to Virtualization http://www.kernelthread.com/publications/virtualization/

Blue Alliance's blog http://www.bluealliance.it/weblog/200312archive001.asp

by K. Scott Allen K.Scott Allen
My Pluralsight Courses
The Podcast!