You are not logged in.

#1 2021-01-01 14:37:26

equalizer876
Member
Registered: 2018-09-11
Posts: 78

Btrfs mounting and compression

Happy new year.

As I'm using Btrfs my fstab contains mount options like

rw,noatime,compress=zstd:3,ssd,space_cache,commit=120,subvolid=256,subvol=/@,subvol=@

Standard zstd compression level is 3. Do you also use this level or even more compression?
The Btrfs wiki (https://btrfs.wiki.kernel.org/index.php/SysadminGuide) states the option "compress-force" saves even more space (around 10% more). Should I set compress-force too?

Last edited by equalizer876 (2021-01-01 14:40:47)

Offline

#2 2021-01-04 14:44:09

eric
Member
From: under heaven
Registered: 2004-02-11
Posts: 117

Re: Btrfs mounting and compression

It is either 'compress' or 'compress-force' not both.

The problem is that some files (jpg, png, mp3,...) are already compressed.
Compress will make BtrFS check if a file is compressible, if yes, the data will be sent to the compressor.
Compress-force will make BtrFS send the data immediately to the compressor. The compressor will do the check if a file is compressible, if yes, the data will be compressed.

Some say that the zstd-compressor is doing a better job than BtrFS in checking if a file is compressible, so for zstd the recommendation is to use compress-force.

Happy New Year too for you and every one reading this.

Last edited by eric (2021-01-04 14:52:10)

Offline

#3 2021-01-13 17:58:53

equalizer876
Member
Registered: 2018-09-11
Posts: 78

Re: Btrfs mounting and compression

Thank you very much. I'll probably apply "compress-force". It wouldn't really affect the performance, would it?

Found https://btrfs.wiki.kernel.org/index.php … NT_OPTIONS

Otherwise some simple heuristics are applied to detect an incompressible file. If the first blocks written to a file are not compressible, the whole file is permanently marked to skip compression. As this is too simple, the compress-force is a workaround that will compress most of the files at the cost of some wasted CPU cycles on failed attempts. Since kernel 4.15, a set of heuristic algorithms have been improved by using frequency sampling, repeated pattern detection and Shannon entropy calculation to avoid that.

Last edited by equalizer876 (2021-01-13 18:49:48)

Offline

Board footer

Powered by FluxBB