Virtual PC: Shrinking a new Virtual Disk

Lemme see if I’ve got this process straight now. Create the Virtual Machine, then…



  1. Host: Compress the Virtual Disk file.
  2. VM: Start the VM and Install the Guest OS.
  3. Guest: Disable pagefile entirely, and restart OS.
  4. Guest: Stop all services.
  5. Guest: Compress entire hard drive(s).
  6. Guest: Defrag til the cows come home (at least 20x).
  7. Guest: Restart needed network services, so I can…
  8. Guest: Install Eraser, create a new “zeroes” method of unused space overwriting, setup unused space task.
  9. Guest: Run Eraser (possibly 2x).
  10. Guest: Shut down OS & VM.
  11. Host: Run Virtual Disk Wizard to compress Virtual Disk to new file.
  12. Host: Defrag Virtual Disk file til the cows come home.

Dang… that’s involved! VMWare definitely beats Virtual PC here.


It’s several hours worth of drive grinding, in fact, but it’ll get that image file as small as possible, and should make it run faster.


Alright, so I’ve doc’d the process for future reference. Some further explanation and tips:



  • I compressed twice, both in the guest and host OS. This does several things:

    1. Sacrifices CPU for better hard disk performance, which is Virtual PC’s speed bottleneck.
    2. Frees more space in the Guest OS, which can then be zeroed-out and shrunk more effectively by the Host OS’s file compression.
    3. Achieves an overall smaller image file. When combined with “trimming the Windows fat” *, it can make VMs of most basic Windows installs fit on a single CD.

  • I stopped all services for the compression and defrag. This unlocks more files which can then be compressed and defragged.
  • I defragged til the cows come home, because…

    1. A spanking fresh Windows install is already quite fragmented, and file compression fragments it much more.
    2. Windows’ built-in defragger is by no means thorough. Running it several dozen times is as close as it gets. Fortunately this can (now) easily be scripted for easy walking-away.
    3. Theoretically, free-space defragmentation should also help the external compression scheme too, but this is the worst . Most 3rd-party defrag tools would be more effective at this.

  • Step 8 may need to be repeated. I’m not sure why, but sometimes Eraser doesn’t do the trick the 1st try. The indication of this is the Virtual Disk file not actually shrinking.
  • I suggest disabling Undo disks for this process. It only adds one more looong step of merging the undo disk with the original.
  • Step 3: If you’ve got the RAM (say 1GB), give it to the VM and disable its pagefile. That’ll further bypass the slow disk issue.
  • Step 12: I use Defragmentor Lite for single-file defragging. I also sometimes find it effective to switch between that and Windows’ defrag utility.
  • * “Trimming the Windows Fat”

    1. Uninstalling via Windows Add/Remote Components: MSN Explorer and most of Windows’ Accessories (I just keep Paint around for screenshots).
    2. Uninstalling via various obscure commands:

      • Agent: %windir%\system32\RunDll32.exe advpack.dll,LaunchINFSection %windir%\INF\agtinst.inf, RemoveAgent
      • Messenger: %windir%\System32\RunDll32.exe advpack.dll,LaunchINFSection %windir%\INF\msmsgs.inf,BLC.Remove

    3. Deleting various nonessential files:

      1. All temp files
      2. Search for files matching “*.bmp; *.wma; *.wmv; *.wav”. Of these, most of the biggest ones can be deleted without being noticed.
      3. Possibly %windir%/DriveCache/ ? Hardware won’t change in a VM. I’ve successfully done it before without problem. The worst that should happen is prompting for the install CD. Not sure what other repercussions this could have.


As way of disclaimer: I’m no expert/guru/pro with VPC. These are just my learnings and observations so far after a few years’ use and fiddling. I’ll gladly defer to the pros on this, but I haven’t seen much on this subject either.


2005-03-12 update: I just found out that SP1 for VPC makes the disk prep steps slightly simpler (the “zeroing” part).  It does this via a new Virtual Disk Pre-compactor CD image which it makes available for mounting, which saves the extra hassle of installing and configuring Eraser.  (via Robert Moir’s excellent VPC site)

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *