Reclaim wasted capacity of VMDK files

 

When you delete data on thin-provisioned disks, the physical size of the VMDK file for the disk remain the same as before deleting the data, thin-provisioned  disks grow in one direction, but doesn’t shrink automatically, and this is a big issue for vSphere admins., lets assume that you have a 5GB thin-provisioned disk with 2GB of data on it, then the actual size for the VMDK file will be 2GB, the VMDK file size will remain 2GB after deleting all of the data on it.

VMware has solved this issue in vSphere 6.5 with a new auto clean feature for think provisioned VMDK, but if you are using older versions of vSphere then the manual method is the only way to accomplish this.

This mechanism is available for both Windows and Linux guest operating systms.

This article is focusing on Windows OS.

Quick steps:

  1. Download SDelete tools. (google it).
  2. run the tool inside the guest OS in CMD.
  3. run CMD as administrator.
  4. Navigate to the sdelete tool folder path.
  5. run the command against all of the partitions (or select the partitions you need to shrink): sdelete.exe -z x:
  6. power off the VM once the task is done.
  7. connect to the ESXi host using SSH.
  8. navigate to the VMDK file location onthe data store.
  9. list the vmdk files of the folder >> ls -lh *.vmdk
  10. run the following command: vmkfstools -K <VMDK file name>.vmdk (the “K” must be capital).
  11. Power on your VM again.
  12. you are done.

 

Tutorial Video:

Arabic only

 

 

 

Leave a Reply

%d bloggers like this: