Connect to VM host using SSH
Step 1:
First get the naa ID from the affected LUN. You can do this by using the command:
# esxcli storage vmfs extent list
Step 2:
To confirm if SCSI UNMAP is supported on a LUN, open an SSH session to a host and run this command:# esxcli storage core device vaai status get -d naa.xxxxxxxx
Step 3:
if deleted status supported run following command to reclaim free space
Example:
If you want to release 60 percent of the free memory extend the command with 60:
vmkfstools -y 60
Few Useful Commands:
Lun Information:on storage array
lun show -v /vol/vol2/thin-lun
Detailed volume information:
vmkfstools -Ph -v 1 /vmfs/volumes/source-datastore/
The vmkfstools -y
command is deprecated in ESXi 5.5. To reclaim unused storage blocks on a VMFS datastore for a thin-provisioned device, run the command:
esxcli storage vmfs unmap --volume-label=volume_label|--volume-uuid=volume_uuid --reclaim-unit=number
For example, for a VMFS volume named MyDatastore
with UUID of 509a9f1f-4ffb6678-f1db-001ec9ab780e
, run the command:
esxcli storage vmfs unmap -l MyDatastore
--reclaim-unit=200
or
esxcli storage vmfs unmap -u 509a9f1f-4ffb6678-f1db-001ec9ab780e -n 200
Notes:
- It should be noted that this process can lead to high latency on the affected LUNs. So this work should better be done during a maintenance window.
- Calculate reclamation size based upon datastore free space; you cannot reclaim more space than the datastore is able to provide.
- This command creates temporary hidden files at the top level of the datastore with names using the
.vmfsBalloon*
pattern (for example,.vmfsBalloonGdwBBv
). These files can be as large as the aggregate size of blocks being reclaimed. If the reclaim operation or storage access is interrupted, these temporary files might not be automatically deleted and you must delete them manually to create free space on the datastore.