Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Using vmkfstools to reclaim VMFS deleted blocks on thin-provisioned LUNs (2014849)

Details

vSphere 5.0 introduced the VAAI Thin Provisioning Block Space Reclamation (UNMAP) Primitive. This feature was designed to efficiently reclaim deleted space to meet continuing storage needs. ESXi 5.x issues UNMAP commands for space reclamation during several operations.

Solution

VMware recommends disabling UNMAP on ESXi 5.0 hosts with thin-provisioned LUNs. When a virtual machine is migrated from a datastore or deleted, UNMAP is called immediately and space is reclaimed on the array. There were some issues with this approach, however, primarily regarding performance and an array's ability to reclaim the space in an optimal time frame.

For this reason, the UNMAP operation is disabled by default in ESXi500-201112001 (ESXi 5.0 Patch 02) and ESXi 5.0 Update 1. This is now a manual process. This means that tasks such as Storage Migration and Snapshot Consolidation do not automatically attempt UNMAP on the back end LUN. If you continue to use an unpatched ESXi 5.0 host, you must manually disable UNMAP on all hosts. For more information, see Disabling VAAI Thin Provisioning Block Space Reclamation (UNMAP) in ESXi 5.0 (2007427).

ESXi 5.0 Update 1 includes an updated version of vmkfstools that provides an option (-y) to send the UNMAP command to the storage arrays, regardless of the ESXi host's global setting. This option also exists on earlier ESXi versions, but does not reclaim the space when run.

Note: When you run vmkfstools --help, the -y option is not displayed in the help output.

In ESXi 5.5, vmkfstools -y is deprecated and is replaced by the esxcli storage vmfs unmap command. However, issuing UNMAP is still disabled by default and space reclamation can be done manually by running the esxcli storage vmfs unmap command. For more information, see Using esxcli in vSphere 5.5 to reclaim VMFS deleted blocks on thin-provisioned LUNs (2057513).

If your storage vendor has tested this option with storage arrays, you may use it to reclaim deleted blocks resulting from deleting or moving files from VMFS datastores residing on thin-provisioned LUNs.

Confirming if SCSI UNMAP is supported on a LUN

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


Example output:

naa.60a98000572d54724a346a6170627a52
VAAI Plugin Name: VMW_VAAIP_NETAPP
ATS Status: supported
Clone Status: supported
Zero Status: supported
Delete Status: supported


In this example, the device displays the Delete Status as supported, meaning that it is capable of sending SCSI UNMAP commands to the array when a space reclaim operation is requested.

Using vmkfstools -y in vSphere 5.0 U1 or later and vSphere 5.1

To use the -y option with vmkfstools, run these commands:

# cd /vmfs/volumes/volume_name
# vmkfstools -y percentage_of_deleted_blocks_to_reclaim


Caution: If a percentage value close or equal to 100 is specified, the temporary balloon file that is created during the reclamation operation might fill up the VMFS volume. Any growth of current VMDK files due to running virtual machines writing to their disks or the creation of new files, such as snapshots, might fail due to unavailable space. Use care when calculating the amount of free space to reclaim.

Notes:
  • The time that the operation takes to complete varies by storage vendor. As the operation is time consuming, consider running it during a maintenance window because the high I/O generated by the SCSI UNMAP operation may impact storage performance on the array, thus impacting running virtual machines.
  • 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.

Example usage

To reclaim 60% of the free space on a datastore named Datastore1 in the current directory, run the commands:

# cd /vmfs/volumes/Datastore1
# vmkfstools -y 60


If there is 10 GB of free space on the example VMFS volume Datastore1, the operation will reclaim 60% of the 10 GB of space; in other words, 6 GB will be reclaimed.

Additional Information

To be alerted when this article is updated, click Subscribe to Document in the Actions box.


For translated versions of this article, see:

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 52 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.

What can we do to improve this information? (4000 or fewer characters)




Please enter the Captcha code before clicking Submit.
  • 52 Ratings
Actions
KB: