Archive for the ‘Apple’ Category

Shrink your Windows disk image on VMWare Fusion (Mac)

March 31, 2008

It is possible to free up quite a bit of hard disk space by compacting your virtual disks for VMWare.

Here is a easy (manual) way to shrink a Windows guest image hosted on VMWare Fusion for Mac OS. I have used the recipe below to successfully save about 50% of disk space for a Windows 2003 R2 guest image on Mac OS 10.5.2 running VMWare Fusion 1.1.1. Other Windows guest OS’s like Windows 95, 98, NT 4.0, Win2K, XP should work with this recipe as well, although this is untested at this time.

Warning: This recipe may/may not work for you. Beware of the risk! Remember to backup your disk image before messing with it. Finally, do not shrink a disk with snapshots as this is known NOT to work!! Update: See additional recipe at bottom of this post for how to deal with snapshots.

Shrink recipe:

  1. First backup your guest os disk image and other files (just in case something goes wrong) + make sure you have plenty of spare disk space on your harddrive.
  2. Start Windows guest OS in VMWare Fusion and login as administrator
  3. Clean up & defrag guest OS disk image from within guest OS
    * Delete all unused files, empty your trash can, delete your browser cache etc.
    * Defragment your guest OS (f.x. using “defrag c:” in the cmd prompt).
  4. Zero out unused disk space in guest OS disk image
    * Download Mark Russinovich’s disk erase tool SDelete v1.51+ and place it on the local guest drive (*1).
    * From a command prompt navigate to where you saved the above delete tool and write “sdelete -c c:”, which will clear all free disk space
  5. Close guest OS and VMWare
    * Shutdown your Windows guest OS.
    * Quit VMWare fusion
  6. Shrink disk image using VMWare’s diskTool
    * Navigate to the VMWare Fusion tools directory. E.g. type “cd /Applications/VMware Fusion.app/Contents/MacOS”
    * Run VMWare Fusion’s diskTool command with the shrink option “-k” to compact your virtual drive (*.vmdk). E.g. type “./diskTool -k 0 full-path-to-your-virtual-desk-image.vmdk”. (*2)
  7. Finished!

*1) Nb. this erase tool is not documented to be compatible with Windows 2003/XP, but it works just fine on on my Win2003 R2 (as far as I can tell).

*2) Do remember the “./” when running diskTool to avoid mis-executing the Mac OS disk tool with the same name instead.

UPDATE – QUICK SNAPSHOTS CONSOLIDATION TIP:

If your disk image has snapshots you need to consolidate those into one large disk before attempting the above recipe. You can create a single disk image by cloning (merging) your disks using VMWare’s diskCreate tool (located in same folder as diskTool). The procedure is:

  1. Again backup your stuff first in case things go wrong (and again make sure you have plenty of spare disk space).
  2. Create a new folder with the extesion .vmwarevm to hold the output files.
  3. Navigate to the VMWare Fusion tools directory. E.g. type “cd /Applications/VMware Fusion.app/Contents/MacOS”
  4. “./diskCreate -C path-to-latest-snapshort-vmdk-file.vmdk path-to-new-merged-disk-file.vmdk” (use output folder above for destination).
  5. Copy the .vmx , .vmdk and .vmxf files into the output folder. Use a texteditor to edit the .vmx (and .vmxf) files to reflect the new disk file name.
  6. Test that the new consolidated image works in VMWare fusion.
  7. You can now proceed to the recipe for shrinking your disk.

VM-ware Fusion and remote desktop fun

August 7, 2007

While I’ve been using apple computers for years now, I’m new to virtualization.

Because we develop web applications using Ruby on Rails, we decided to work with apple MacBooks. This is really nice because we then look cool while writing cool code, but a challenge when we do consultancy work on other platforms. Currently I’m doing Sharepoint (MOSS 2007) development for a customer and for this MacOS just won’t cut it. For this we’ve bought VMware Fusion. I cannot praise this magnificent piece of software enough. It just works (and I’m still running with the beta version).

So a couple of days ago I had to connect via remote desktop to my MOSS development environment and change my default password. To change my password on the Windows 2003 server I had to do a “ctrl-alt-delete“, and then it hit me… How the heck do I do this with my MacBook keyboard?! I’ve started a Windows XP in VMware Fusion and connected to a (virtual) Windows 2003 Server through Remote Desktop (talk about virtualization :)). I search the net but could not really find anything about this cocktail, so I wanted to share my findings on this tricky key combination (or at least store it somewhere for when I need it again in six months):

fn-M + numeric enter (the funny up arrow next to the right apple key) + <– (the top right delete key)

I used like an hour to figure this one out 🙂


Design a site like this with WordPress.com
Get started