ESXi supports the unmap commands issued directly from a guest operating system to reclaim storage space. The level of support and requirements depend on the type of datastore where your virtual machine resides.
Inside a virtual machine, storage space is freed when, for example, you delete files on the thin virtual disk. The guest operating system notifies VMFS about freed space by sending the unmap command. The unmap command sent from the guest operating system releases space within the VMFS datastore. The command then proceeds to the array, so that the array can reclaim the freed blocks of space.
Space Reclamation for VMFS6 Virtual Machines
VMFS6 generally supports automatic space reclamation requests that generate from the guest operating systems, and passes these requests to the array. Many guest operating systems can send the unmap command and do not require any additional configuration. The guest operating systems that do not support the automatic unmaps might require user intervention. For information about guest operating systems that support the automatic space reclamation on VMFS6, contact your vendor.
Generally, the guest operating systems send the unmap commands based on the unmap granularity they advertise. For details, see documentation provided with your guest operating system.
The following considerations apply when you use space reclamation with VMFS6:
VMFS6 processes the unmap request from the guest OS only when the space to reclaim equals 1 MB or is a multiple of 1 MB. If the space is less than 1 MB or is not aligned to 1 MB, the unmap requests are not processed.
For VMs with snapshots in the default SEsparse format, VMFS6 supports the automatic space reclamation only on ESXi hosts version 6.7 or later. If you migrate VMs to ESXi hosts version 6.5 or earlier, the automatic space reclamation stops working for the VMs with snapshots.
Space reclamation affects only the top snapshot and works when the VM is powered on.
Space Reclamation for VMFS5 Virtual Machines
Typically, the unmap command that generates from the guest operation system on VMFS5 cannot be passed directly to the array. You must run the esxcli storage vmfs unmap command to trigger unmaps for the array.
However, for a limited number of the guest operating systems, VMFS5 supports the automatic space reclamation requests.
To send the unmap requests from the guest operating system to the array, the virtual machine must meet the following prerequisites:
The virtual disk must be thin-provisioned.
Virtual machine hardware must be of version 11 (ESXi 6.0) or later.
The advanced setting EnableBlockDelete must be set to 1.
The guest operating system must be able to identify the virtual disk as thin.