VMware Cloud Community
binoyrc
Contributor
Contributor

Shrink disk size after deletion of files on guest OS - Thin virtual disk

We are using thin virtual disk for all our virtual servers. One of the challenges we are facing is disks are not getting reclaimed from guest OS if the data is deleted. For example, if I allocate a 100GB thin disk to a virtual server from datastore, initially it will only use a few MB from datastore then later if I fill up that 100GB with data on guest OS, datastore usage also will increase by 100GB.. later if I delete these 100GB data on guest OS, I am not getting this space back on datastore. Size of my vmdk file will be still 100GB. I am looking for a method to shrink the unused blocks from gust and make that space available to datastore. I am sure, many other customers also facing similar issue in relation with space. I was wondering how this challenge is being managed. Please let me know if I did not explain my concern correctly.

3 Replies
vvenu
Enthusiast
Enthusiast

This is most common issue with thin provisioned volumes and you need to run "UNMAP" to reclaim the space which is manual process.

Run this command to make sure your storage supports all VAAAI primitives.

esxcli storage core  device vaai status get -d  naa.XXXXXXXXXX

If the output  displays Delete Status as supported meaning that it is capable of sending SCSI UNMAP commands to the array when a space reclaim operation is requested.

then follow below KB as per your environment

VMware KB: Using esxcli in vSphere 5.5 and 6.0 to reclaim VMFS deleted blocks on thin-provisioned LU...

VMware KB: Thin Provisioning Block Space Reclamation (VAAI UNMAP) does not work

For version 5.1 or later versions: VMware KB: Using vmkfstools to reclaim VMFS deleted blocks on thin-provisioned LUNs

Good luck!!

a_p_
Leadership
Leadership

Please take a look at the vmkfstools command line's --punchzero option (see e.g. https://kb.vmware.com/kb/2004155) to see whether this is an option for you.

André

Reply
0 Kudos
hussainbte
Expert
Expert

This KB should work.

VMware KB: Using vmkfstools to reclaim VMFS deleted blocks on thin-provisioned LUNs

If you found my answers useful please consider marking them as Correct OR Helpful Regards, Hussain https://virtualcubes.wordpress.com/