Storage array space not reclaimed after Guest OS cleanup on VMFS
search cancel

Storage array space not reclaimed after Guest OS cleanup on VMFS

book

Article ID: 323112

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides instructions to reclaim unused storage blocks on a VMFS datastore. When files are deleted within a Guest OS, the underlying storage array may not immediately reflect the free space due to the disk provisioning type or VMFS version settings.

Environment

  • vSphere: 7.x, 8.x
  • Datastore: VMFS5, VMFS6
  • Disk Type: Thick Provision Lazy Zeroed, Thick Provision Eager Zeroed, Thin Provision

Cause

Space reclamation (UNMAP) requires the virtual disk (VMDK) to be Thin Provisioned. Thick Provisioned disks (Lazy or Eager Zeroed) are pre-allocated at the VMFS layer. While space is freed inside the Guest OS, the static size of a Thick VMDK prevents the "punching" of holes that triggers UNMAP commands to the storage array.

Resolution

1. Verify VAAI UNMAP Support Confirm the LUN supports the Delete Status primitive:

esxcli storage core device vaai status get -d <device_ID>

Ensure the output shows Delete Status: supported.

2. Convert Thick VMDKs to Thin Provisioning To enable array-level reclamation for Thick Provisioned disks:

  • Use Storage vMotion to migrate the VM to a different datastore while changing the disk format to Thin Provision.
  • Alternatively, use the vmkfstools command to reclaim zeroed blocks:
vmkfstools --punchzero /vmfs/volumes/DatastoreName/VMName/VMName.vmdk

3. Trigger Manual UNMAP (if using VMFS5 or Manual VMFS6) Identify the volume label and run:

esxcli storage vmfs unmap --volume-label=volume_label --reclaim-unit=200

Note: Consult the storage vendor for the optimal --reclaim-unit value.

4. Automatic Reclamation (VMFS6) VMFS6 performs automatic asynchronous UNMAP. If space is not reclaiming:

  • Ensure the "Space Reclamation" priority is not set to "Disabled" in the Datastore settings.
  • Verify the Guest OS is sending discard/unmap commands (e.g., fstrim for Linux or Optimize-Volume for Windows).

Additional Information