Home » Categories » Multiple Categories

Reclaiming disk space from thin provisioned VMDK files on ESXi

Step 1: Delete the blocks on the Guest OS

Windows Operating System
  1. Download SDelete Command Line Tool available at https://docs.microsoft.com/en-us/sysinternals/downloads/sdelete
Note: SDelete -z will cause the guest OS to use up 100% of the available space disk during this process while zeroing free space. This will lead to a temporary increase in used space on the datastore.
  1. Open an elevated command prompt.
  2. Run this command
sdelete.exe -z drive_letter:
Note: Replace [drive:] with the target disk or partition. Note that when you have multiple partitions on a single virtual disk, you need to do this on all partitions for it to be effective. Otherwise, reclamation will only be partial because not every data block will be zeroed.
Linux Operating Systems:

Linux has different ways to delete the unused blocks, the most common method is to fill the free space with a file of zeroes using the dd command:
dd if=/dev/zero of=/mounted-volume/zeroes && rm -f /mounted-volume/zeroes

  • Be sure to shutdown all services which writes to the target volume to avoid running out of space
  • If there are multiple partitions on a single virtual disk, same step needs to be performed on all partitions. Otherwise the reclamation will be partial because not every data block will be zeroed.

Step 2: Reclaim space on VMFS

  1. Power off the virtual machine.
  2. Log in to the ESXi host using SSH and root credentials.
  3. Navigate to the directory that contains the virtual machine disk using the command:
cd /vmfs/volumes/DATASTORE_NAME/VM_NAME
  1. Run this command:
vmkfstools -K disk_name.vmdk

  • The file used here is descriptor file .vmdk file not the data file -flat.vmdk
  • The process may take longer depending on the size of the disk and number of blocks.



Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Comments Comments
There are no comments for this article. Be the first to post a comment.
Related Articles RSS Feed
Windows VPN route selective traffic by destination network
Viewed 302 times since Tue, Dec 27, 2022
Migrate qcow2 images from KVM to VMWare
Viewed 3224 times since Sat, Feb 20, 2021
Reclaim Used Space with VMKFSTOOLS - Punchzero
Viewed 991 times since Sat, Jan 1, 2022
How to Export a vSphere ESXi 6.7 Virtual Machine
Viewed 1044 times since Sun, Feb 7, 2021
Where are the shortcuts for the Windows 7 Taskbar stored on disk?
Viewed 290 times since Tue, Jan 24, 2023
VMware - Using the OVF Tool deploy
Viewed 508 times since Sun, Jan 2, 2022
Failed to reconfigure virtual machine Test-VM. The operation is not allowed in the current state.
Viewed 1021 times since Fri, Dec 31, 2021
Convert Thick Provision Lazy Zeroed Disk to Thin on VMware ESXi by vmkfstools
Viewed 621 times since Sat, Jan 1, 2022
OVFTool - Error: SHA digest of file ExortedVM.ovf does not match manifest
Viewed 1825 times since Mon, Jan 3, 2022