Compression on f2fs system volume

I’ve been using f2fs on my nvme system drive for quite a while now, I know that it supports compression, in CachyOS at least lz4 and lz4hc - other methods for some reason are not displayed in the parameters, and this is even included in fstab:

❯ modinfo f2fs | grep compress

depends: lz4_compress,lz4hc_compress
parm: num_compress_pages:Number of intermediate compress pages to preallocate (uint)

~

defaults,compress_algorithm=lz4,compress_chksum,gc_merge,lazytime 0 1

But for some reason the volume itself is created during the system installation via Calamares without the option to enable compression, so compression does not work. Is this a bug or a feature? :slight_smile:

Hi,

Be aware, that f2fs compression does not actually reduce the file/storage size. We do not enable it currently, since there were problems in the past and also needs to be modified in calamares for a proper integration.

data compression isn’t about file size, it’s about improve read and write, and save space for inline data

how to enable compression https://www.kernel.org/doc/Documentation/filesystems/f2fs.txt
you must scroll down to the end of the page

Thanks for your reply, very useful information. But shouldn’t the volume be formatted with compression option initially? For example, like this:

sudo mkfs.f2fs -f -c lz4 /dev/sda2

it should according to the arch wiki but nothing ever happen.

 sudo cat /sys/kernel/debug/f2fs/status | grep compress
  - compress:    0, hit:       0

So even if you create a volume with the compression option, the files still aren’t compressed? Unfortunately, at the moment I don’t have any free volumes to try to implement this.

unfortunately without compression :frowning:
i created the volume in summer 2022 and until now:

sudo cat /sys/kernel/debug/f2fs/status | grep compress
  - compress:    0, hit:       0

compression works when:

  1. filesystem was created with: -O extra_attr,inode_checksum,sb_checksum,compression
  2. and mounted with: compress_algorithm=lz4,compress_chksum,compress_extension=*
sudo cat /sys/kernel/debug/f2fs/status | grep Compress
  - Compressed Inode: 8968, Blocks: 138322