Windows 10 NTFS compression of copied files

compressionntfswindows

I'm experiencing an odd issue in Windows 10 that involves copying files that are compressed using the NTFS filesystem to another folder that has the compression flag set (so that when the file is copied, it is compressed in the destination folder).

The issue is that when the file is copied to the folder, the filesystem is not recognizing that the file is compressed, and appears to store on disk a copy of the original file and another copy of the file that is supposed to be what is actually stored (the compressed variant). Thus, the disk is recognizing that double the space is needed to store the file (e.g. if the file was 500MB, the remaining capacity for the disk will be 1000MB less).

Also, I've experienced this on several Windows 10 installs, so I'm wondering if anybody else has seen this.

Of course, restarting the computer seems to correct the reported free disk space remaining, but while in a session, I've had to decompress a file manually then recompress it to have the filesystem report the correct size. The system believes that much more disk space is being consumed that what is really there, and it is leading to insufficient disk space errors (in testing out the problem, I made a dummy partition and copied the compressed file to it).

Thanks for any help.

Best Answer

That is because for any NTFS compressed file being copied (or even accessed for that matter), first it has to be decompressed to make it readable for Windows. This is because the NTFS compression is done at the file system level, and at Windows OS level there is no difference in the way it reads the contents of the file. So when the compressed file is copied to the compressed destination folder, it is first decompressed at NTFS level, then copied to the destination folder at the OS level, and then it is again compressed back at the NTFS level to match the compression attribute of the destination folder (and it is not compressed back because the source file being copied was compressed to start with, however, in the case of moving a file it retains the compression attribute of the source file irrespective of the destination folder attribute). Now this temporary uncompressed version of the compressed file that was decompressed, copied, and then re-compressed, still exists in the destination drive until the computer is restarted or disk cleanup or ccleaner utility is used to cleanup system files. This is exactly why the double file size count was solved on restart. Therefore, for a compressed drive it is always recommended to set aside at least enough free space to fit an additional uncompressed version of the largest compressed file contained within the drive.