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.
- remove any unneeded apps/packages, files, etc and empty the trash.
- clean up the YUM package files with (terminal commands as root):
- yum clean packages
- yum clean metadata
- yum clean dbcache
- (or) yum clean all
- 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.
- 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:
- sudo apt-get autoclean
- (or) sudo apt-get clean
- (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).
- remove any unneeded apps, files, etc and empty the trash.
- 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.
- 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.
- use the utility Monolingualto remove unneeded Architectures, Input Types, and Languages from OS X and installed application packages.
- 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.
- 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
- use the “Input Menu” tab to select what to remove.
- use the “Architectures” tab to select what to remove.
- 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.
- use the disk utility app (within the VM) to erase free space on the disk.
- close the VM and exit VMware Fusion
- use the vmware-vdiskmanager utility to shrink the VMDK.
- open Finder, browse to the stored VM, right click and show package contents, locate the file “your-vm-name-here.vmdk”.
- open Terminal and CD to “/Applications/VMware\ Fusion/Contents/Library/”
- type “./vmware-vdiskmanager -k “
- drag the VMDK file from Finder to Terminal (this will append the file path and name to the command.
- In terminal, enter the command to shrink the vmdk.