WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Hardware Options
    • Hardware Reviews
    • Lab Deployment Scripts
    • Nested Virtualization
    • Homelab Podcasts
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Configure new automatic Space Reclamation (VMFS UNMAP) using vSphere 6.5 APIs

Configure new automatic Space Reclamation (VMFS UNMAP) using vSphere 6.5 APIs

10.31.2016 by William Lam // 6 Comments

Since its first introduction in vSphere 5.5, VMFS UNMAP also know as Space Reclamation for a VMFS based datastore has been a pretty popular Storage capability in vSphere. A commonly asked question from customers is when will the "automatic" capability return? Well, it looks like it is now back in the upcoming vSphere 6.5 release as blogged about here by Duncan Epping. Below is a screenshot of where you can find the setting. VMFS UNMAP is now enabled by default and you will need to have a VMFS 6 datastore to take advantage of this new feature.

vmfs-unmap-vsphere-65-api-0
For customers who wish to automate the configuration of the VMFS UNAMP capability whether that is to check the current settings or to enable/disable it, there are some new vSphere 6.5 APIs that have been introduced which differ from the previous implementations. To change the VMFS UNMAP setting, there is a new vSphere API called UpdateVmfsUnmapPriority() which accepts the UUID of a VMFS 6 datastore as well as an unmapPriority property which can either be "low" which means it is enabled or "none" which means it is disabled. To view the current VMFS UNMAP settings, there is a new property under the Datastore->Info->Vmfs object called UnmapPriority.

To demonstrate this new vSphere API, I have created two small PowerCLI functions called Get-VMFSUnmap and Set-VMFSUnmap which can be downloaded from here.

Here is an example of retrieving the current VMFS UNMAP settings:

Get-Datastore "mini-local-datastore-hdd" | Get-VMFSUnmap

vmfs-unmap-vsphere-65-api-1
Here is an example of enabling automatic VMFS UNMAP setting:

Get-Datastore "mini-local-datastore-hdd" | Set-VMFSUnmap -Enabled $true

vmfs-unmap-vsphere-65-api-2

More from my site

  • When to use Move-VM cmdlet vs xMove.ps1 script for performing Cross vCenter vMotions?
  • PowerCLI module for Proactive HA (including simulation)
  • New vSphere 6.5 APIs worth checking out
  • Super easy way of getting ESXi installation date in vSphere 6.5
  • Using latest PowerActions 1.5.0 to issue VMFS UNMAP API in vSphere 6.0 Web Client

Categories // Automation, vSphere 6.5 Tags // PowerCLI, unmap, vmfs, vSphere 6.5, vSphere API

Comments

  1. *protectedAlexey Stromilov says

    10/31/2016 at 8:30 am

    Great news! Thank you.

    Reply
  2. *protectedwolruf says

    10/31/2016 at 9:36 am

    Can there be collision between guest OS unmap and vSphere's ? http://cormachogan.com/2015/05/07/vsphere-6-0-storage-features-part-8-vaai-unmap-changes/ ?
    Similarly, do you need the storage to be VAAI or VAAI-NAS enabled ?

    Reply
  3. *protectedStephane says

    11/18/2016 at 3:47 am

    Thank you for this information.
    What is exactly "low" ?
    Is it time between execution, task's priority, I/O load, or something else ?
    Thank you in advance.

    Reply
  4. *protectedJosh Beard says

    08/15/2017 at 12:53 pm

    What event or criteria triggers the automatic unmaps? Normally we run umaps manually throughout out environment a couple times a year. Trying to understand if the automatic unmaps will accomplish this.

    Reply
  5. *protectedIlias says

    07/12/2018 at 9:14 am

    Www w

    Reply
  6. *protectedchristoffer zettermark says

    02/12/2021 at 7:16 am

    I noticed that the script collects all hosts connected to a datastore (into $vmhostview). Is it necessery to do this? Is the auto-unmap-setting accutally a per host setting? Or just per datastore?

    Reply

Leave a Reply to StephaneCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Failed to locate kickstart on Nested ESXi VM CD-ROM in VCF 9.0 06/20/2025
  • NVMe Tiering with Nested Virtualization in VCF 9.0 06/20/2025
  • VCF 9.0 Installer workaround for ESXi hosts with different vendor 06/19/2025
  • NVMe Tiering with AMD Ryzen CPU workaround for VCF 9.0 06/19/2025
  • vSAN ESA Disk & HCL Workaround for VCF 9.0 06/19/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...