The DC2-flat.vmdk
file you see listed with a size of 400GB is the actual size of the virtual disk as it is allocated on the datastore. This does not necessarily mean it is using that entire space for data, especially if you have performed steps to zero out and shrink the disk.
Here's a breakdown of what's happening:
- SDelete: Running
sdelete -z
inside the guest OS zeros out free space, making it possible to reclaim unused space at the VMFS level.
- VMKFSTools: The command
vmkfstools -K DC2.vmdk
is used to punch out zeroed blocks and reclaim space on a thin-provisioned virtual disk.
After performing these steps, the space within the VM should be reclaimed, and the size shown in vSphere (52GB) reflects the used space within the VM. However, the ls -lh
command shows the allocated size on the datastore.
Thin-Provisioned Disks
If your VMDK is thin-provisioned:
- The actual used space on the datastore should be less than the allocated size. This discrepancy is normal and indicates that the space within the disk is not entirely occupied by data.
Verifying Actual Usage
To verify the actual space usage, you can use the following command:
du -h /vmfs/volumes/your_datastore/your_vm_directory/DC2-flat.vmdk
This command will show you the actual disk usage, which should reflect the reclaimed space.
Thin-Provisioning Check
Ensure your disk is thin-provisioned by using the following command:
vmkfstools -D /vmfs/volumes/your_datastore/your_vm_directory/DC2.vmdk
Look for a line indicating if the disk is thin-provisioned.
Shrink Command
Ensure that the vmkfstools -K
command was successful. You can also use vmkfstools -p
to see the current allocation of blocks.
Conclusion
The size shown by ls -lh
(400GB) is the provisioned size, not the actual used space. To ensure this space is not occupied, verify with du
and confirm the thin-provisioned status with vmkfstools
.
If this is still the case, try doing a storage migration to another DS and selecting each disk and changing it to "Thin Provisioning".
I am very interested to see how this goes. Please follow up.