VMware Cloud Community
nettech1
Expert
Expert
Jump to solution

unable to recover unused space using vmkfstools

I have a Windows XP VM which had a thick provisioned 20GB HDD with only 10GB being used. With the VM powered off I ran vmkfstools -i XPTICK.vmdk -d thin XPTHIN.vmdk and ended up with a thin provisioned disk, which shows 19,827,710 as Size and 20,971,520 as Provisioned Size. When I power up the VM, it’s showing 10 of HDD space being used. Is there another way to recover the unused space? ESXi5.5 U2  standalone Thank you

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

If zeroing the free disk space (sdelete with the -z option) didn't cleanup enough free adjacent clusters, i.e. the data on the virtual file system is spread across the partition, there's unfortunately not much vmkfstools can do. In such a case you may need to use e.g. VMware Converter and run a Volume Based (Advanced options) V2V conversion.

André

View solution in original post

0 Kudos
7 Replies
a_p_
Leadership
Leadership
Jump to solution

Did you cleanup the guest OS prior to run vmkfstools, i.e. did you defragment the guest OS and zero out unused disk space?

André

nettech1
Expert
Expert
Jump to solution

I defragmented the drive, but didn't zero it out. What tool should be used for that?


-K --punchzero ?

Thanks

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

You need a tool that writes zeroes within the guest OS's filesystem itself. A well known tool for this is SDelete.

After zeroing out the guest file system, you may then use vmkfstools with the --punchzero option to reclaim the zeroed disk space.

André

0 Kudos
nettech1
Expert
Expert
Jump to solution

Thank you.


can I run vmkfstools  --punchzero XPTHIN.vmdk  once SDelete finishes or I need to run through a conversion one more time?

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

The --punchzero option is made for thin provisioned virtual disks, so you should be able to reclaim the disk space using the command after zeroing out the guest. However, don't expect a reduction all the way down to the guest's used disk space. Defragmenting will help, but may not reorganize/relocate files on the virtual disk.

André

0 Kudos
nettech1
Expert
Expert
Jump to solution

I ran SDelete inside the guest OS and then  vmkfstools --punchzero thin.vmdk
no space recovered

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

If zeroing the free disk space (sdelete with the -z option) didn't cleanup enough free adjacent clusters, i.e. the data on the virtual file system is spread across the partition, there's unfortunately not much vmkfstools can do. In such a case you may need to use e.g. VMware Converter and run a Volume Based (Advanced options) V2V conversion.

André

0 Kudos