TRIM/UNMAP not working on vSAN cluster even after it is enabled
search cancel

TRIM/UNMAP not working on vSAN cluster even after it is enabled

book

Article ID: 394562

calendar_today

Updated On:

Products

VMware vSAN

Issue/Introduction

The below has been performed yet TRIM/UNMAP does not work on vSAN datastore:

  • TRIM/UNMAP is enabled on the vSAN cluster.

  • Verified each host to see if UNMAP is enabled. The following command can be run in SSH of ESXi, in the output, the parameter "current value" of 1 indicates that it is enabled:

    • To check if TRIM/UNMAP is enabled on the cluster level - vsish -e get /config/VSAN/intOpts/Unmap

    • To check if TRIM/UNMAP was enabled for GuestOS - vsish -e get /config/VSAN/intOpts/GuestUnmap

  • The VMs have been power cycled. (NOT Restart)

 

Symptoms:

  • The command to perform TRIM/UNMAP immediately is run within the Guest OS, but no UNMAP/TRIM occurs:
    • For Linux VMs fstrim command was used.
    • For Windows VMs the Optimize-Volume command was used.

Environment

VMware vSAN (All versions)

Cause

The UNMAP/TRIM command (fstrim/Optimize-Volume) for the GuestOS was not run using a user with sufficient permissions.

Resolution

To resolve this issue, run the TRIM/UNMAP command using the highest privilege within the respective GuestOS:

  • For the Linux VMs, the command - sudo fstrim --all -verbose

    Can be run within the GuestOS to send UNMAP/TRIM command immediately to vSAN, to reclaim the unused space.

  • For Windows VMs the command - Optimize-Volume -DriveLetter <DriverLetter> -ReTrimVerbose

    Can be run within the GuestOS in a PowerShell/Command prompt which was opened as "Run as administrator".

Additional Information