We seem to have a number of NTFS drives like this where they consume much more space on the virtual disk than they do as files.
Noticed the problem when Windows Server Backup was taking-up much more space than the files themselves.
As am example, we have a small drive with mainly office documents:
- Size of actual files: 2.78Gb
- Disk properties used: 6.03Gb
- Size of compressed .vhdx: 27Gb
It is not the recycle bin, I have deleted that. It is not shadow copied, I have deleted them.
There doesn't seem to be any way of defraging these virtual drives on Server 2012 so nothing we can do there either.
Any other suggestions what is taking up this much space?
Deleting data inside of the VM doesn't cause the size of the VHDX to decrease. Once the VHDX grows it will remain that size, or grow larger as the amount of data inside the VM increases.
If you want to recover some of the disk space on the host that is being consumed by the VHDX you can compact the VHDX.
Additionally, you could shrink the Windows volume inside the VM and then shrink the VHDX.
To add to joeqwerty's answer, as he's right as the virtual hard disk size will not decrease automaticly when you delete some files from inside the partition.
To compact you could do it with the Hypervisor's menu.
In ESX: Virtual Machine > Virtual Machine Settings->Hardware->Utilities > Compact
In HyperV: Inside the VM in the tool menu for the HHD click Optimise. After that close the VM, in the Hypervisor itself or another Windows VM right click the VHDX, click Mount and click Optimize.
A old method was to mount the VHDX via diskpart, but I do not suggest it now.
To explain the size;
The tool usually fill the HDD partition table where files was before and no longer exist to fill it with zero. The optimize we run after hard delete those 'zero'ed' reference from inside the VHDX. As in the past, pre-2012, we had to run sdelete -z to zero out empty space from inside the VM which was filling to 100% to .VHDX, and after we compacted the VHDX when the VM was close. Now the process is easier.