One of the advantage and feature of VMWare virtualization products such as VMware Workstation, Vmware Fusion and VMware ESXi is the ability to take snapshots, and multiple of them. Snapshots, essentially the same with checkpoints in Microsoft Hyper-V, is the state of a system and data frozen at a particular point in time.

VMWare’s snapshots allow administrators to easily go back and forth between different snapshots, mainly for the purpose of recovery in case anything goes wrong, or for backup which is very fast and efficient without any downtime. In addition, snapshots can also be cloned to create any branch with diverging version of the data.

While snapshots are very useful, it has one main problem – it’s using a lot of disk space. For non-preallocated hard disk (sparse disk image), the size of the VMware virtual disk will grow over time, especially after downloading and installing major updates and service packs to the operating system.

The virtual disk file size for a virtual machine does not reduce and shrink automatically. Administrator has to manually run the ‘compact’ command to shrink the sparse virtual disk image. But if you have taken snapshots, the file size can grow exponentially and the compacting and shrinking process takes a long time to complete. And in some versions of VMware, VMware doesn’t allow shrinking and compacting of virtual hard disk.

The best way to manage the VMware sparse virtual disk image file size is to prevent it from growing too fast. One of the trick is to take the snapshot when the VM is in the Power Off state. This is because the snapshots of running VMs require additional disk space as large as the size of the RAM memory, which the snapshots need to preserve too.

If you shutdown the virtual machine and take the snapshot, the files related to the snapshot can be as small as a few hundred KBs, as VMware only saves the differential changes. Thus, if you can afford to shutdown a running VM, it’s recommended to power off it before taking a snapshot.