I came up against a problem today whilst working on fixing a design to work correctly in both IE6 and IE7. That problem was, I am running IE6 in a Windows XP virtual machine in VMWare Fusion on my Macbook Pro. Normally, I test IE7 on my Vista desktop and IE6 in the Virtual Machine. However, as I’m in Wagga and only have my laptop, I don’t have access to IE7 on a machine that has all my development tools on it.
So I was thinking, why don’t I just duplicate the current virtual machine and then using the duplicate, update it to IE7. Turns out this is more complicated than it sounds, but that’s for another time.
Upon pulling up the directory with the virtual machine files in it, I discovered the Windows XP virtual machine was taking up 31gb when the usage according to Windows was only 13gb! That’s a pretty big difference, especially considering my VMWare preferences were set so the footprint would only be the size of the usage – even though Windows thinks it has a 100gb drive to access. This in and of itself isn’t a problem, except I only had 27gb free which is not enough to duplicate the virtual machine in.
So I set to trying to figure out how to reduce the size down to a more manageable and accurate size.
First off, I remembered I had taken a snapshot about 6 months ago which could potentially be taking up a fair amount of space, so I deleted it.
This took about 45 minutes to finish while VMWare Fusion was “Cleaning up deleted files”. Once it was done though, my XP virtual machine was down to 27gb.
Basically, it turns out that VMWare anticipated this problem and one of the tools in the optionally installable VMWare Tools pack is a very quick and easy to use “Shrink” tool.
To access it, make sure VMWare Tools are installed by going to the Virtual Machine menu and clicking “Install VMWare Tools”. If it has “Update” instead of “Install” then they are already installed.
Once it’s installed, if you haven’t disabled it, click the icon in the task bar and the click “Open VMWare Tools”.
You’ll be brought to the main VMWare Tools window which has a series of tabs. Click the “Shrink” Tab.
Here you can select a drive to shrink. In most cases on desktop Windows virtual machines, you will only have the one supported partition that is able to be shrunk, C:.
Select it and click the “Prepare to shrink” button. For me, it took about 30 minutes to prepare it to be shrunk. Once it was ready, to go it brought up a dialog box confirming I wanted to shrink the virtual machine footprint. After clicking yes, it took about 20 minutes to shrink it down to 14gb, just a bit bigger than the actual disk usage according to Windows. Perfect.