Windows – Tweaking NTFS Compression Ratio for Folders

compressionntfswindows

As it seems, Windows compresses the NTFS compressed folders with the lowest compression ratio possible. While this maybe good for increasing speed and decreasing CPU load, for the files that are accessed rarely (backup folders) it would be more sensible to have the possibility to increase the compression ratio. Are there some parameters that may be tweaked to achieve this?

Best Answer

Short answer

No, it's not possible at this time.

Long answer

Files and folders1 are compressed and decompressed by passing a FSCTL_SET_COMPRESSION control code and a compression state to the DeviceIoControl API function. The compression state can be one of the following:

COMPRESSION_FORMAT_NONE = 0
COMPRESSION_FORMAT_DEFAULT = 1
COMPRESSION_FORMAT_LZNT1 = 2

Any nonzero value means the target item is going to be compressed. From the official documentation:

The LZNT1 compression algorithm is the only compression algorithm implemented. As a result, the LZNT1 compression algorithm is used as the DEFAULT compression method.

Source: FSCTL_SET_COMPRESSION control code

The LZNT1 algorithm is designed for speed, and there's no way to set a custom compression level.

1 Folders aren't actually compressed: their compression attribute only gives a default compression state to new files and subfolders.

Additional information

The NTFS file system volumes support file compression on an individual file basis. The file compression algorithm used by the NTFS file system is Lempel-Ziv compression. This is a lossless compression algorithm, which means that no data is lost when compressing and decompressing the file, as opposed to lossy compression algorithms such as JPEG, where some data is lost each time data compression and decompression occur.

On the NTFS file system, compression is performed transparently. This means it can be used without requiring changes to existing applications.

If you compress a file that is larger than 30 gigabytes, the compression may not succeed.

Source: File Compression and Decompression

The compression algorithms in NTFS are designed to support cluster sizes of up to 4 KB. When the cluster size is greater than 4 KB on an NTFS volume, none of the NTFS compression functions are available.

Source: File and Folder Compression

Further reading

Related Question