Compression of F2FS data using LZO / LZ4 + selective management of file extensions to land in 2020
F2FS is the latest Linux file system that supports transparent data compression to save disk space. With F2FS, two compression algorithms are supported so far, as well as support for enabling per-file data compression or applying compression to select file extensions.
In October, I wrote about experimental support for F2FS LZO / LZ4 compression. This work went from simple fixes on their mailing list to now queuing in the “dev” branch of F2FS before now merging with the Linux 5.6 kernel in early 2020.
Linux 5.6 is configured to provide F2FS data compression! The implementation is similar to the transparent / native file compression of Btrfs, with a few additional features. F2FS compression support can be set using the compress_algorithm mount option currently for LZO or LZ4 algorithms. There is also compress_log_size mount option to change the size of the compression cluster. One of the interesting options with the F2FS implementation is compress_extension and with that you can specify any arbitrary extension where F2FS should automatically attempt to compress the data.
Namely, with compress_extension you can try to compress text files which normally offer higher compression rates than, say, image files and binaries. The implementation of F2FS also makes it possible to use chattr + c [file || directory] to enable compression on other arbitrary files or directories.
This F2FS compression support should be quite handy and for now can be found via the development branch until Linux 5.6 hits town in early 2020.