How to Tune Up a Virtual PC
If your VPC seems slow try the following steps to rectify.
1. Have separate drives for your Page File, Host operating system, and VHD file
2.Try defragging again using O&O defrag (http://www.oo-software.com/home/en/products/oodefrag/) instead of the standard windows defrag tool, it works better. The steps below may take some time but should dramatically improve the responsiveness of your VPC. Make sure you have at least as much free space on your drive where the .vhd file is located as the current size of the .vhd. For example, if your .vhd file is 8GB, you need 8GB+ of free space. This much free space is not necessary but will speed up the defrag process. At the very least, try to have a couple gigs of free space before running defrag.
Warning: If you run these steps on a differencing or undo disk, compacting will require you to merge the differencing or undo disk with the original. If you cannot do this, your differencing or undo disk will be twice the size. However, it will most likely still perform better.
Note: Running defrag and precompacting are done inside the VPC. Compacting the disk is done using the Virtual PC Console with the VPC turned off.
1. Download the defrag utility and extract the defrag.exe and defragps.dll files to a location on the VPC root drive.
2. Inside the VPC, click Start, and then Run. Type cmd and press ENTER.
3. Change the path to the location where you extracted the defrag.exe and defragps.dll files , i.e. cd c:\tools\defrag and press ENTER.
4. Type defrag -d c: and press ENTER.
5. Let this process go for awhile. At the end your .vhd file will be about twice the size.
Next, you must precompact inside the VPC before compacting the .vhd.
1. On the VPC menu click CD, then Capture ISO Image.
2. Browse to C:\Program Files\Microsoft Virtual PC\Virtual Machine Additions\
3. Double-click Virtual Machine Precompactor.iso
4. If it doesn't launch, open the D drive in Explorer and double-click precompact.exe.
5. Let this process run. When it's done, shut down the VPC.
Now you can compact the .vhd file using the Virtual PC Console
1. Go to the Virtual PC Console, select your VPC, and then click Settings.
2. Select Hard Disk 1.
3. Click Virtual Disk Wizard.
4. Click Next on the first screen of the wizard.
5. Click Edit an existing virtual disk, and then click Next.
6. Click Browse on the Virtual Disk to Edit screen of the wizard and browse to your .vhd file. Select it and click Open.
7. Click Next.
8. Click Compact it (this should be the default), and then click Next.
9. Click Replacing the original file, and then click Next.
10. Click Finish. The disk compacting will start.
Other Performance Tips
- Disable all visual enhancements
1. Right-click My Computer, and then click Properties.
2. On the Advanced tab click the Settings button in the Performance section.
3. On the Visual Effects tab, click Custom then uncheck everything in the list below.
4. Click OK.
- Turn off automatic updates
- Set hardware acceleration to full
1. Right-click the desktop, and then click Properties.
2. On the Settings tab click Advanced.
3. On the Troubleshoot tab, move the Hardware acceleration slider to Full.
4. Click OK
- If you have an old spare 20GB drive lying around, you can use that as an external USB drive and dedicate the entire partition to a single VPC. This will have good performance even with undo disk on as there is virtually little or no fragmentation even over prolonged usage.
- Hard disk paging is bad. Make sure that you balance memory allocation for both the VPC and the Host machine. Allocating too much memory to the VPC can cause your host machine to page to the hard disk and vice versa. With 2GB memory on the host machine, you can allocate 1GB to the VPC with good performance (even with Outlook 2007 and the IE browser running).
- Try the Windows registry optimization with your host machine and VPCs.
- Disable paging of the OS core files (look for the registry keyDisablePagingExecutive inHKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management and set the value to 0x1)
- Disable the updating of the last access timestamp on the file system (run fsutil behavior set disablelastaccess 1 from the command prompt).
- Reboot. Note the first registry tip is only useful if you have sufficient memory allocated to avoid hard disk paging.
- To improve performance for applications in the VPC (applies to Windows Servers 2003)
- Right click on Computer and select Properties.
- Select the Advanced tab.
- In the Performance section, click on Settings.
- Under the Advanced tab, select best performance for Programs instead ofBackground services. For windows 2003 servers, this is normally set toBackground services.
- If you have a Core Duo or Core 2 Duo processor on your machine, it should have support for hardware virtualization support. Make sure to do the following:
- Turn on the Virtual Machine Monitor (VMM) in the bios settings. Depending on the bios type, there may be one or two settings related to this. Make sure all are enabled. If you do not see the settings in the bios, it means your hardware manufacturer has not implemented the support.
- Enable Hardware Virtualization support in VirtualPC 2007. In the Virtual PC Console, go to File menu and select Options.
- Under every VPC's settings, you should then be able to set the Hardware Virtualization option. This is only grayed out if you haven't done the previous two steps or if you don't have the right processor.
- In the virtual machine, make sure that you have installed the latest VirtualPC 2007 Virtual Additions if you have not done so.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)