Pierre Flammer

VMware Space Reclamation - On All Datastores

Blog Post created by Pierre Flammer Employee on Jul 29, 2016

Reclaiming space in VMware is an annoying thing.

But with a little help from VMware's community it can be a much simpler process.

I saw a recent comment in an old Thread and thought it would be a good idea to finally post this.

I found the attached script here: https://communities.vmware.com/message/2437373

 

Here's what the script does after you pointed it to vCenter:

 

1) Get a list of all datastores and loop through them.

2) Find out how much space is free and calculate 0,5% of that.

    This is something you can tune in line 144. (I've never touched it)

[decimal]$freeDSSpace = $ds.FreeSpaceMB

$unmapSize = [MATH]::round($freeDSSpace*.005)

3) Run the vmfs unmap

 

I've been using this Script for the past year and gave it to most of my customer.

Never saw any problems with it.

 

Have fun!

Pierre

Outcomes