Used disk space in ESXi and OS are wildly different

virtual-machinesvmfsvmware-esxi

I am running ESXi 6.5u1 on my server and I have a VM with a thin provision with a max size of 128gb and the VM is reporting having a used space of about 4gb but ESXi is provisioning more than 64gb to the virtual hard drive. I have tried defragging the disk and cloning it into a new thin provision but it is still using far too much space. du -h –max-depth=1 and df -h are both reporting about 3.5 gb of total used space yet ESXi reports more than 64 gb. Here are some screenshots of this:

du -h: http://i.imgur.com/MwtMXkt.png
df -h: http://i.imgur.com/UFVckww.png
ESXi: http://i.imgur.com/QhZl0vA.png

Another unrelated problem is that I am unable to remove the floppy drive on the VM, when I shut the machine down and remove it, it just comes back once I reopen the VM editor.

Here is a picture of the same stats on my DNS server, as you can see it is not having the same issue. Both VMs are version 13, and on the same datastore which is vmfs 6.

disk usage reported in ESXi: http://i.imgur.com/fG6By4d.png
disk usage reported on OS: http://i.imgur.com/5p4dASL.png

The difference with the DNS server is much smaller and can be explained by snapshots and allocated RAM.

Best Answer

I tried this and it worked perfectly

http://www.virten.net/2014/11/howto-shrink-a-thin-provisioned-virtual-disk-vmdk/

Basically, you use DD to make a file full of zeros that is as large as how much free data you have left on the drive and you use vmkfstools -K on your vmdk file which deletes zeros and effectively shrinks the file.

Related Topic