Optimizing a test virtual disk for distribution over our internal network

Last week, someone sent me a Vista image to copy to my machine to use for testing. This image is a virtual hard drive for use with HyperV, so all I needed to do was copy the file, create a basic virtual machine and start it. Due to some hardware problems, copying the file (about 19 GB) was on track taking a full day. I tried to find the machine which hosted the file so I could use my USB stick as a sneakernet and get the file, but the machine was not in our building and no one really knew where the administrators who manage the server kept it.

Fortunately, there was a tester on our team that had a copy of the file from before copying it to the server, and I managed to get the test running. But I started thinking about that 19 GB and it seemed very excessive. We decided to try and optimize the file - we want to give this out to others, and even if the copy time shrinks to 30 minutes (for arguments sake) once the hardware is repaired, if we can cut the size of the file down, that results in more time saved across everyone involved. If 50 people copy the file, and we can shrink it in half, we would get

50 * 15=750 minutes time saved (napkin math in action!), or about a day and a half of testing time saved.

So looking at the install of Vista, hibernation was turned on, taking up about 2 GB of virtual hard drive space. Turning that off (go to a DOS prompt as an admin and type powercfg -h off) saves about 10% of the space. Deleting the swap file at shutdown saved another 2 GB. System Restore was also enabled, and turning that off saves 15% of the space.

Running the component cleaner saved another 720 MB. It's worth mentioning at this point that running the component cleaner and disabling system restore means I can't uninstall any patches or otherwise roll back the system. This is fine, though, since I am running it in a virtual environment and can rely on HyperV to take snapshots and revert the state if needed.

Deleting misc. files like images and such freed up 100MB or so, but I didn't want to spend too much time going through the file system looking for more files that aren't needed in a test environment. I was hitting the point of diminishing returns on my time and did not want to go down a black hole here.

Lastly, I turned off Aero just to minimize memory usage. That was hard to track, but it looks like it reduced memory usage by about 30-50MB.

Zipping the file got it down to under 7GB. This was over a 60% savings - not too shabby! Now to get the server hardware fixed so this can be shared…

Questions, comments, concerns and criticisms always welcome,


PS: Nothing else going on around here.

Comments (6)

  1. I’d like it to be true that Win 7 could similarly be trimmed and optimized so it could fit and work undemandingly on a Motion 1400 tablet.

  2. What is the Component Cleaner?

    Also, Windows Phone 7 looks hot!  I’m torn between replacing my Touch Pro WM6 phone with a 6.5 phone now and then getting WP7 after a year and prices have dropped, or just sticking it out with my love-hate relationship with my current phone and getting the WP7 on launch.  Decisions, decisions!!!

  3. JohnGuin says:

    component cleaner uninstalls the files that are kept around when you patch Windows.  They are used in case you later need to uninstall a patch, so removing them means you can’t uninstall some components any more.

  4. Where do I find it?  I googled but I’m not seeing it.

  5. I need to break the google habit!  Bing rocks!

Skip to main content