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,