Note: If you are using datastores as VMFS-6 in ESXi 6.5 or above, this article is not applicable.
There are two ways in which the disk space reclamation tasks could be invoked:
To confirm if SCSI UNMAP is supported on a LUN, open an SSH session to an ESXi host and run this command:
esxcli storage core device vaai status get -d naa.##############
You see output similar to:
naa.<ID>
VAAI Plugin Name: VMW_VAAIP_NETAPP
ATS Status: supported
Clone Status: supported
Zero Status: supported
Delete Status: supported
To reclaim unused storage blocks on a VMFS datastore for a thin-provisioned device, run this command:
esxcli storage vmfs unmap --volume-label=volume_label|--volume-uuid=volume_uuid --reclaim-unit=number
i.e. specify the volume by label or uuid:
-l|--volume-label=volume_label
The label of the VMFS volume to UNMAP.
-u|--volume-uuid=volume_uuid
The UUID of the VMFS volume to UNMAP.
optionally specify:
-n|--reclaim-unit=number
The number of VMFS blocks to UNMAP per iteration. If it is not specified, the command uses a default value of 200.
For example, for a VMFS volume named MyDatastore with UUID of 509a9f1f-########-####-########780e, run this command:
esxcli storage vmfs unmap -l MyDatastore
or
esxcli storage vmfs unmap -u 509a9f1f-########-####-########780e
Notes:
Alternatively, you could use vmkfstools with the switch -y to reclaim unused storage blocks. Historically, this command could only be used to reclaim only a certain percentage of space, but now, this has been tweaked to accommodate blocks.
The use case would be as follows:
vmkfstools -y --reclaimBlocks /vmfsPath
[--reclaimBlocksUnit #blocks]
Example :
vmkfstools -y --reclaimBlocks 200 /vmfs/devices/disks/naa.<ID>
Notes: