Windows – Why does NTFS compression take up a lot of space

ntfswindows

To save some disk space I figured it might be a good idea to compress the VMware vSphere Client I have installed because I almost never use it.

I was surprised to find that it had the exact opposite effect on free disk space. I tracked it down further and found that it is related to compressing the Help folder. The loss of disk space is not reflected in the folder size.

I repeated the compress/decompress cylce three times to make sure another program did not coincidentally take up the disk space. It might be notable that the folder contains a large number of small files (≈ 30k).

Why is that so and can I somehow find other folders that I should decompress to save disk space?


Without compression:

folder size without compression
free space without compression

With compression:

folder size with compression
free space with compression

Best Answer

A bit of background knowledge regarding the folder size screenshots you provided:

Uncompressed

As expected with many small files there is a lot of overhead. Your hard disk is partitioned with a certain block size - 4KB by default for NTFS.

Each file has to allocate a multiple of 4KB, meaning no matter if you have a 1KB or a 3.5KB file, both will take 4KB of space. If you have a 13KB file it will use 16KB on your drive. The difference between "Size" and "Size on disk" is the overhead introduced by unused space in blocks, the so called cluster tips.

Compressed

After compression "Size" is still the same as the amount of net data has not changed at all. However compression was able to reduce the total size about 130MB. In fact even more because the overhead here also applies. So compression did actually save some space in that folder and that is also displayed in the folder size.

Now regarding the behavior you see with the reduced free disk space on drive C: This can have multiple reasons. One thing to understand is that free disk space will always be less than

<Disk size> - <total size of all files>

This is because there is a lot of metadata which also eats up space (VSS Snapshots, System Restore points, MFT and so on).

During compression of single files NTFS will temporarily keep the original file until compression has completed. This is to ensure that you still would be left with a valid version of the file in case your computer crashed. This however should only be temporary. Nevertheless everything points to NTFS metadata to cause this.

To more accurately verify results you can do the following:

  • Start with an uncompressed folder
  • Disable System Protection for each volume (Computer properties/System Protection)
  • Delete the restore points for each volume in the same dialog
  • Use "Disk Cleanup" in the properties of your volume C: to remove temporary files
  • Note the free disk space
  • Compress the folder
  • Restart your computer
  • Use disk cleanup again
  • Check the free space on your disk

In theory you should be able to see an increase in free space