Reduce size of guest vmdk disks with VMware Fusion 4.1.3 on OS X 10.8

When running multiple VMs, and keeping backup copies of various configs, a considerable amount of disk space can be used quickly.  The following steps have been confirmed to reduce disk usage for several virtual machine guest operating systems.

  • Oracle Linux R6 U3 64-bit
  • centOS 6.3 64-bit
  • Ubuntu 12.04 LPS 64-bit
  • openSUSE 12.1 64-bit
  • Mac OS X (multiple versions)

Oracle Linux R6 U3 and CentOS 6.3:  *these steps utilize a desktop environment and VMtools.

  1. remove any unneeded apps/packages, files, etc and empty the trash.
  2. clean up the YUM package files with (terminal commands as root):
    1. yum clean packages
    2. yum clean metadata
    3. yum clean dbcache
    4. (or) yum clean all
  3. at the command line, type “vmware-toolbox” to launch the VMware Tools GUI within the guest VM.  This is equivalent to the GUI available within Windows guests.
  4. Select the drive (partition) to Shrink.  1st the utility will prepare the drive for the shrink process and then a final dialog box will be presented to begin the shrink drive operation.

Ubuntu 12.04 LPS:  same as described for centOS and Oracle Linux, except the YUM commands are replaced with:

    1. sudo apt-get autoclean
    2. (or) sudo apt-get clean
    3. (0r) sudo apt-get autoremove

*note: Ubuntu 12.04 utilizes the Ubuntu Software Center for GUI application management (and has the annoying characteristic of only working with one selection at a time); installing the “Synaptic” package manager provides a more traditional Linux package manager.

openSUSE 12.1:  same as described for centOS and Oracle Linux, except YAST handles the package and cache cleanups (instead of yum or apt-get).  Options are available within the YAST GUI.

OS X:  10.6 Snow Leopard, 10.7 Lion, and 10.8 Mountain Lion (including servers).

  1. remove any unneeded apps, files, etc and empty the trash.
  2. using Finder, navigate to the following folders and remove unneeded fonts and dictionary files for languages you’re certain you won’t need for this VM.  Sort the folder contents by size and select the largest.  You can verify font files by opening them in the “font book” app to preview.
    1. /System/Library/Fonts/
    2. /Library/Dictionaries/
    3. /Library/Fonts/
    4. note: sometimes the system will state a font is in use and need a restart before allowing all of the deleted fonts to be emptied from the trash.
  3.  use the utility Monolingualto remove unneeded Architectures, Input Types, and Languages from OS X and installed application packages.
    1. If you know you have an app which needs to be excluded, use the Monolingual “Preference” to add the app’s location to a list of excluded directories.
    2. in the main app, use the “Languages” tab to select which languages to remove (be sure to scroll the entire list and de-select any you wish to keep).  On a fresh install of OS X 10.8 Mountain Lion, selecting all but English, French, and Spanish removed about 1.6GB
    3. use the “Input Menu” tab to select what to remove.
    4. use the “Architectures” tab to select what to remove.
    5. note: Monolingual only removes the items in the visible tab; if you desire to remove items from all three tabs, you’ll need to run it three times.
  4. use the disk utility app (within the VM) to erase free space on the disk.
  5. close the VM and exit VMware Fusion
  6. use the vmware-vdiskmanager utility to shrink the VMDK.
    1. open Finder, browse to the stored VM, right click and show package contents, locate the file “your-vm-name-here.vmdk”.
    2. open Terminal and CD to “/Applications/VMware\ Fusion/Contents/Library/”
    3. type “./vmware-vdiskmanager -k “
    4. drag the VMDK file from Finder to Terminal (this will append the file path and name to the command.
    5. In terminal, enter the command to shrink the vmdk.
Advertisements

One thought on “Reduce size of guest vmdk disks with VMware Fusion 4.1.3 on OS X 10.8

  1. to disable hibernate (aka safe sleep) in Mac OS X, use these terminal commands:
    * disable safe sleep mode: sudo pmset hibernatemode 0
    * remove the sleep image file: sudo rm -rf /var/vm/sleepimage

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s