Checklist for space reclamation of Windows VMs on vSAN
search cancel

Checklist for space reclamation of Windows VMs on vSAN

book

Article ID: 461102

calendar_today

Updated On:

Products

VMware vSAN

Issue/Introduction

This article provides a checklist of the prerequisites and procedures for reclaiming unused storage space from Windows virtual machines running on VMware vSAN.

When files are deleted from a Windows virtual machine, the guest operating system reports the released space as available. However, the consumed storage capacity on the vSAN datastore may not decrease accordingly.

The TRIM/UNMAP feature allows Windows to notify the underlying storage layer that certain blocks are no longer in use, enabling vSAN to reclaim unused storage space.

Environment

VMware vSphere ESXi 8.x, 9.x

VMware vSAN 8.x, 9.x

Windows virtual machines supporting TRIM/UNMAP

Resolution

Verify the following prerequisites before performing space reclamation.

Checklist 1. Verify that Guest TRIM/UNMAP is enabled on the vSAN cluster.

In the vSphere Client, select the vSAN cluster and navigate to:

Configure > vSAN > Services > Advanced Options > Guest Trim/Unmap

If Guest TRIM/UNMAP is disabled, click EDIT and enable the option "Guest Trim/Unmap".

Alternatively, connect to an ESXi host through SSH and run:

esxcli system settings advanced list -o /VSAN/GuestUnmap

For environments where this setting is configurable, verify that the value is:

Int Value: 1

  • 0 = Disabled
  • 1 = Enabled

 

Checklist 2. Verify that the Windows virtual machine uses VM version (hardware version) 11 or later.

In the vSphere Client:

  1. Select the virtual machine.
  2. Open the Summary tab.
  3. Check the panel of VM Hardware for Compatibility information.

If the VM version is lower than 11, upgrade it to a supported version before performing Guest TRIM/UNMAP.

 

Checklist 3. Verify that the affected virtual disk supports thin provisioning and space reclamation.

  1. Select the virtual machine in the vSphere Client.
  2. Navigate to Edit Settings.
  3. Identify the affected virtual disk and its associated VM Storage Policy.
  4. Verify that the storage policy does not specify 100% Object Space Reservation when a reduction in physically allocated capacity is expected.

The amount of physical storage reclaimed depends on the virtual disk configuration and its assigned storage policy.

 

Checklist 4. Verify that the affected virtual disk uses a SCSI controller supporting Guest UNMAP.

Supported controller types for this procedure include:

  • VMware Paravirtual SCSI (PVSCSI)
  • LSI Logic SAS

If the virtual disk uses an unsupported controller, evaluate changing it to a supported controller type.

 

Checklist 5. Verify disk.scsiUnmapAllowed

  • Power off the virtual machine.
  • In the vSphere Client, navigate to:
    Edit Settings > Advanced Parameters
  • Locate the following parameter:
    disk.scsiUnmapAllowed
    Ensure that the parameter is not set to FALSE.
  • The default value is TRUE. If the parameter is absent, it is not necessary to add it. However, it can be explicitly configured as:
    disk.scsiUnmapAllowed = "TRUE"

 

Checklist 6. Perform a Complete VM Power Cycle

After enabling Guest TRIM/UNMAP or changing the relevant virtual machine settings, perform a complete power cycle.

  1. Gracefully shut down the Windows virtual machine.
  2. Ensure that the virtual machine is completely powered off.
  3. Power on the virtual machine.

A complete power cycle ensures that the virtual machine recognizes the updated UNMAP capabilities.

A guest operating system restart alone may not be sufficient.

 

Checklist 7. Verify Windows TRIM/UNMAP Configuration

Log in to the Windows virtual machine and open Command Prompt as Administrator.

Run:

fsutil behavior query DisableDeleteNotify

For an NTFS volume, verify that the result shows:

NTFS DisableDeleteNotify = 0  (Disabled)

  • 0  (Disabled) = TRIM/UNMAP enabled
  • 1  (Enabled) = TRIM/UNMAP disabled

If disabled, enable it using:

fsutil behavior set DisableDeleteNotify NTFS 0

Alternatively, verify the corresponding Windows registry setting using PowerShell:

Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\FileSystem" -Name DisableDeleteNotification

The expected value is:

DisableDeleteNotification : 0

Same as above, a value 0 of this parameter means TRIM/UNMAP enabled.

 

Checklist 8. Manually Trigger Space Reclamation in Windows

After verifying all prerequisites, manually initiate TRIM/UNMAP from within the Windows virtual machine.

  1. Log in to Windows.
  2. Open PowerShell as Administrator.
  3. Run the following ReTrim command:

Optimize-Volume -DriveLetter E -ReTrim -Verbose

Replace E with the appropriate drive letter.

For example, to reclaim unused space from the C: drive:

Optimize-Volume -DriveLetter C -ReTrim -Verbose

Alternatively, open Command Prompt as Administrator and run:

defrag E: /L /U /V

The operation instructs Windows to issue TRIM/UNMAP requests for unused blocks on the specified volume.

Note: If files were deleted before Guest TRIM/UNMAP was enabled, executing the ReTrim command after enabling the feature and power cycling the VM can help reclaim previously released space.

 

Checklist 9. Verify Space Reclamation Results

After the ReTrim operation completes, verify that the consumed storage capacity has decreased.

  1. Log in to the vSphere Client.
  2. Select the affected Windows virtual machine.
  3. Review its consumed storage capacity.
  4. Compare the storage usage before and after executing the ReTrim command.
  5. Navigate to the vSAN cluster and review the datastore capacity utilization.

Where available, UNMAP activity can also be monitored under:

vSAN Host > Monitor > vSAN Performance > Backend > Trim/Unmap Throughput

The actual amount of reclaimed capacity depends on the volume of unused blocks, the virtual disk configuration, and the vSAN storage policy.

Space reclamation may be asynchronous, so the reduction in datastore usage may not appear immediately.

Additional Information

  • Deleting files inside Windows does not necessarily result in an immediate reduction in consumed vSAN datastore capacity.

  • TRIM/UNMAP allows Windows to inform vSAN that certain storage blocks are no longer required.

  • The Optimize-Volume -ReTrim command can manually initiate space reclamation for unused blocks.

  • Space reclamation does not reduce the configured capacity of the virtual disk.

  • The amount of storage reclaimed depends on the VM Storage Policy, including the Object Space Reservation and protection level.

  • Initiating large-scale TRIM/UNMAP operations simultaneously on multiple virtual machines may introduce additional storage I/O activity and affect workload performance.