Introduction

SoftPerfect Virtual Disk Trim makes virtual machine disk images smaller. A virtual disk grows as the guest system writes to it, but it does not shrink by itself when files are deleted inside the guest: the guest marks the space as free, yet the blocks stay in the image. The usual remedy is to overwrite the free space with zeros inside the running guest and then have the hypervisor compact the image.

Virtual Disk Trim offers a more effective solution. It reads the file system record of in-use clusters straight from the image file and rebuilds the image without the blocks that hold nothing. This process does not require starting the virtual machine, mounting the disk image, or modifying anything inside the guest. Virtual Disk Trim runs on Windows, macOS and Linux and needs no virtualisation software.

How it works

  • Analysis. When an image is added, Virtual Disk Trim reads its block table, finds the partitions and reads the allocation record of each file system it recognises. It also checks that the image is safe to trim. Only this bookkeeping data is read, so even a large image takes moments, and nothing is written.
  • Trim. A new image is created from the blocks that are in use, leaving out the rest. Everything the guest relies on stays the same byte-for-byte; only free space and files you chose to discard are removed. Volumes with an unrecognised file system are copied without change, and the new disk retains the identity by which the hypervisor knows it. A fixed-size disk is rebuilt as a dynamically expanding one, which is how it gives up its empty space.
  • Verification. The new image is opened again and compared with the original. Only when the contents fully match, the new image replaces original; otherwise it is discarded and the original is left exactly as it was.

Partitions are not moved or resized, and the disk capacity seen by the guest does not change. Only the image file becomes smaller.