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.
VMware vSphere ESXi 8.x, 9.x
VMware vSAN 8.x, 9.x
Windows virtual machines supporting TRIM/UNMAP
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 = Disabled1 = Enabled
Checklist 2. Verify that the Windows virtual machine uses VM version (hardware version) 11 or later.
In the vSphere Client:
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.
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:
If the virtual disk uses an unsupported controller, evaluate changing it to a supported controller type.
Checklist 5. Verify disk.scsiUnmapAllowed
disk.scsiUnmapAllowed
Ensure that the parameter is not set to FALSE.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.
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 enabled1 (Enabled) = TRIM/UNMAP disabledIf 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.
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.
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.
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.