Kudzu World

"Programming is an art form that fights back"

Kudzu World  »  Blogspace  »  Kudzu's Tech Blog
English - Română - Русский - عربي

RSS Feed

If you want to more easily stay informed of updates etc you can subscribe to the RSS feed. Just point your RSS reader at this page, auto discovery is enabled.

Keeping clean and small Virtual Machines


I have about a dozen virtual machines that I use for development and other purposes. I normally have 4-5 running at anyone given time on my development machine, and I also do development on the host as well.

I use desktop virtualization because it has better desktop integration with the host with things like the clipboard, drag and drop of files between them, mouse and keyboard interaction, and graphics performance in most cases is better.

The contest between Microsoft and VMWare in the server virtualization space is hot and competitive with both offering compelling features. The desktop space is no contest however with VMWare Workstation simply obliterating Virtual PC.

I am looking closely at Hyper-V as well, however it only runs on Windows 2008 server. Each time I've used a server operating system as my host I run into third party packages that fail to install on server operating systems or charge ten times the amount to purchase the software as the version for desktop operating systems.

This also requires a decent backup strategy. Virtual Machines take up more space than raw data, but there are ways to keep the size down as well as keep them running efficiently.

Separate the Swap

The amount of RAM I allocate to my guests varies from 256 MB to 1024 MB. In general Windows will make a swap file about the same size as memory. Backing up the swap file makes no sense and takes up a lot of room.

To avoid this, make a second virtual disk 2 GB in size and from within the guest operating system move the swap file to the second disk. After reboot you will need to then delete the swap file from the C: drive. You should also perform a shrink disk after deleting it.

You should also turn off the low disk warning for the swap drive so Windows will not annoy you with the system tray pop up each time you boot.

Now you can back up the virtual machine, but exclude Swap.vmdk. If you ever need to restore, just create another virtual disk and reset the swap file in the guest operating system.

System Restore

Turn off system restore for all drives in the guess operating system. You are backing up the whole virtual machine anyways so you can always revert to a backup if you need such functionality.


Uninstall services and applications that you do not need. A full Windows XP install including Microsoft Office and basic dev tools easily fits in about 5 GB. Such a virtual machine compresses with RAR on best setting down to 1.5 GB. With this strategy you have plenty of room to grow and keep your virtual machine backed up on a single DVD.

Regular Cleanup

From within the guest operating system:

  1. From explorer options, turn on "Show hidden and system files". Now go to c:\Windows and you will see many folders that start with $xxxxx, where x are numeric digits. These are uninstall files for Windows Updates, and they take up quite a bit of room. Delete all of them. Do not delete $hf_mig$ or $Reconfig$
  2. Run disk clean up wizard and allow it to take all actions except compress old files.
  3. Delete c:\Windows\*.log. WindowsUpdate and a few others may give you access denied, but delete the rest. Several of the log files are over a megabyte and they add up as well.
  4. Delete the contents of the c:\Windows\SoftwareDistribution\Downloads folder. You can actually delete all the contents of c:\Windows\SoftwareDistribution but you will loose your update history. The downloads folder contains updates that are already installed and accounts for most of the data by size. For example my SoftwareDistribution folder was 205 MB, 199 MB of which was in the Downloads folder. Eventually Windows cleans this folder up, but you can safely delete it as these updates are already applied on your system.
  5. Open VMWare tools and select Shrink Disks.

There are tools to mount VMWare virtual disks from the host and these steps 1 to 4 could be automated to run without needing to boot the guest.

For step 4, there is a vmware command line utility that can shrink the disks. I guess I need to make a nice FinalBuilder script to do this all. Or maybe the FinalBuilder guys could add some nice new VMWare actions including mount disk, shrink disk, etc.

Backing up

Before backing make sure the virtual machine is powered off and not just suspended or in snapshot mode. Now delete any folders that match *.lck, and *.log files. Use RAR on best compression and compress the remaining files excluding Swap.* (Assuming you named your swap virtual disk Swap). Unless you have really bloated your virtual machine, the resulting file will easily fit on a single DVD. If not you can set RAR to split the files at 4300 MB and burn more than one DVD.

Third Party Tools

<< Previous Entry    Next Entry >>


Patrick van Logchem on 11.06.2009 wrote: You should give CrapCleaner a look (http://www.ccleaner.com/), I'm a happy user; A quote from their homepage : CCleaner is a freeware system optimization and privacy tool. It removes unused files from your system - allowing Windows to run faster and freeing up valuable hard disk space. It also cleans traces of your online activities such as your Internet history. But the best part is that it's fast (normally taking less than a second to run) and contains NO Spyware or Adware! :)
Chad Z. Hower on 11.06.2009 wrote: Thanks, looks like a good basic tool. Still hoping I can find something to run externally directly on the VMX files. I'm looking at moving over to Hyper-V possibly anyways which will change my requirements slightly.
Ryan Cromwell on 11.06.2009 wrote: I personally use Virtual PC only because I'm cheap and VMWare Server was annoying on my Vista x64 host. I've been able to do everything I've wanted with Virtual PC not withstanding a little extra work like the Loopback adapter necessity. Anyways, a huge boost for me has been using Syspreped images. There is a big long post on how to do it here (http://www.windowsnetworking.com/articles_tutorials/Creating-Sysprep-Image-Library-Virtual-PC.html), but it's more jibber-jabber than work.

Post a comment

Use my contact form to contact me directly.