Receive updates via email:

 Updates via RSS

Tag Cloud

Blog Archive

Sunday, November 21, 2010

How to Shrink Windows 7 & Windows Vista Virtual Disk in VMWare Fusion 3.0 on Mac OSX

On my MacBook, I use VMWare Fusion 3.0 (actually 3.1.1) to run Windows 7, Windows Vista, and Ubuntu Linux. Some of the reasons are simple, such as running Microsoft's Entourage in a corporate environment undoubtedly leads to a host of calendaring issues, especially if you have multiple people managing and sharing calendars. (Don't get me started about the iPhone's interaction with Microsoft Exchange, Entourage, and Outlook.)

Overall, I have been extremely happy with the performance of VMWare Fusion 3.0. When combining that with the great hardware and MacOS, definitely a great improvement over previous Lenovo and IBM ThinkPads I had in the past. Start-up, sleep and shutdown times were so much quicker on the MacBook Pro regardless of the operating system.

There was one thing that I began to notice over a period of a few months, however.

Over time, the virtual disk and virtual hard drive files (VMDK) were growing what I considered to be excessively. In fact, for about 30GB of total data on the hard drive, was now taking almost 75GB of hard drive space and noticeably starting to slow down.

I tried the most logical thing I could think of, the built in "Clean Up Disk" function inside of VMWare Fusion. To get to it, you go to Virtual Machine --> Hard Disk --> Hard Disk Settings to clean up the disk.

In VMWare Fusion 3.0 how to Shrink Windows 7, Windows Vista, Windows XP, Windows 2008, Windows 2003, Windows 2000 Virtual Disk

However, after waiting for about 30 minutes for the disk to clean-up to run and shrink the disk back to a manageable size...nothing of significance happened. The Virtual Disk and associated VMDK files were all roughly the same and a total of less than 1GB of the 45GB in "extra" space was used up.

Disappointed in the impact of the tool, I turned to Google to try and find another solution. I came across the 41 Technologies blog, which had a great article that described some of the issues and had instructions on how you could easily shrink your Windows Virtual Machine. Unfortunately, the article was dated (2008) and many of the tools like "diskTool" is no longer in VMWare Fusion 2.0 or 3.0 and the vmware-vdiskmanager tool in VMWare Fusion 2.0 and 3.0 doesn't take the same input, especially when your Virtual Machine is within a package.

Still, the article provided some very useful information and pointed me to a path that allowed me to seriously shrink my VMWare Fusion Windows 7 Virtual Machine from 73.27GB all the way down to just 31.62GB, over a 50% reduction.

Here's how you can do it:

First, realize that all this "extra" space in your virtual machine is due to how Windows manages files and uses the virtual hard drive / virtual disk in Windows that uses a lot of space without "erasing it" or "zeroing it out" when it is no longer used. That leads to serious Virtual Hard Disk bloat, especially in Microsoft Windows based Virtual Machines.

Now, follow the following steps:

1. Do the basic disk clean-up that you'd like to do. Delete extra or temporary files, shrink your PST and OST files if you are using Microsoft Outlook, etc. Eliminate any extra space that you can.

2. Defragment the hard drive on your Virtual Windows this can be done by going to the command prompt and typing in "defrag c:" or the drive letter of the various drives on your virtual machine.

3. Go to the Microsoft Technet site and download the SDelete v1.51 tool by Mark Russinovich; which will enable you to remove the "held space" in files that were deleted, but not zeroed out.

4. Once you've downloaded and installed the tool, head to the command line, head to the install directory of the SDelete tool and type in "sdelete -c c:" (or the appropriate drive). In approximately 30 minutes or less, all the empty space will be zeroed out on your drive.

5. Now head back to the virtual disk manager and run the "Clean Up Disk" utility that can be found at Virtual Machine --> Hard Disk --> Hard Disk Settings to clean up the disk.

In VMWare Fusion 3.0 how to Shrink Windows 7, Windows Vista, Windows XP, Windows 2008, Windows 2003, Windows 2000 Virtual Disk

After about 45 minutes, you'll find that your virtual hard drive had been shrunk back down to a reasonable I mentioned in my case, I went from about 75GB down to 30GB, more than a 50% reduction.

Once that's done, you can enjoy not only your reclaimed space, but also a higher performing Virtual Machine in your VMWare Fusion for Mac. If this worked for you, please let me know below with a comment.

VMWare Fusion Versions this works on:
VMWare Fusion 2.0
VMWare Fusion 3.0

Microsoft Windows Versions this works on:
Microsoft Windows XP
Microsoft Windows 2000
Microsoft Windows 2003
Microsoft Windows Vista
Microsoft Windows 2008
Microsoft Windows 7

Keyword Searches that led to this page:
vmware fusion shrink virtual disk
fusion 3.0 hard drive space
fusion 3.1.1 "clean up disk"
macbook vmware windows 7 performance disk
shrink windows 7 install
shrink windows vista vm


Chris said...

Excellent documentation. Thanks for sharing!

Ken said...

Thank you very much! This solution worked great for me. I was able to shrink my 56gb Windows XP Pro VM down to 18gb! Just what I needed. Thanks!

Carole said...

MacBook Pro 13"
VM Fusion 3.1.2
Windows XP

Was able to retrieve 35+ gb

Great documentation!

J Stafford said...

Very nice work! It only got me about 11 gigs, but it's 11 gigs I didn't have an hour ago. Awesome.

Thanks for the post!

Jurgen Doreleijers said...

Yes, very nice but the last part I'm unclear. The slider and the box don't allow me to put in a smaller size, just a bigger size. What am I doing wrong here.

Ken Hanscom said...

Hi Jurgen. Quick tip: You're not actually resizing your virtual disk, you're just shrinking (compacting) the size of the virtual disk on your drive. Just click on the "Clean Up Disk" button and you should be good!

Jurgen Doreleijers said...

Thanks Ken for the really quick tip. I think I found a way for resizing my virtual disk in the VMware tools inside the VM. It's a tab called 'Shrink' in the VMware tools properties window. But even with that I can't limit the VM to a smaller than current amount. At least I can keep it in check manually.