In a vSphere based virtualization environment we can mainly use two disk types(Thick & Thin).I hope you all know the difference between these two.
To optimize our shared/Direct attached storage we can use thin disk. But the problem is even we delete the data from os level . It will not reclaim automatically from the storage.
To overcome this issue we have two options.
- Use third party tool(if it’s a Windows we can use sdelete) to zero-out the disk blocks and using vmkfstools we can shrink the disk
- Storage vMotion the virtual machine or VMDK to a datastore formatted with a different block size
In this article we are going to showcase how to use sdelete & vmkfstools to this operation
1.This vm we have two thin disks. We will use second disk for the our test case. Capacity of the disk is 3GB
- From the datastore we can see 80.47 GB free space
- We have copied some files to that second disk in the vm(this is windows 7 vm).now we have only 79.65 GB free space on datastore
- Now I’m removing data from the vm
- But still we have only 79GB free space in our datastore
6.Now its time to use sdelete to zero-out the disk.sdelete is a free tool where we can download from microsoft site.
- Just ran the sdelete tool(syntact sdlete.exe -z e:) .E is the drive letter
- During this process it will consume total thin disk size from your datastore. Be careful, we should have enough space to run this tool
- Now we can use vmkfstool to shrink the vmdk(syntact vmkfstools -K w7_1.vmdk
- Now we can again see there is 84GB free space available