The existing text in the wiki isn’t very well-founded.
You can turn on compression at any time by changing the mount options in the fstab. After the next reboot, all newly written data from then on will be automatically compressed. Compression factors of 2:1 on average are not uncommon. @see mount-options
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx / btrfs rw,noatime,compress=zstd,subvol=@ 0 0
Which compression suits me best?
| CPU | rotating disk | SSD |
|---|---|---|
| slow | zstd:1 … 4 | zstd:1 … 3 |
| medium | zstd:4 … 7 | zstd:3 … 5 |
| fast | zstd:7 … 10 | zstd:5 … 10 |
Compression can only be set per volume. So if you set different “levels” of compression for different mounts in the fstab, only the first “level” will be applied. see@btrfs.readthedocs.io
Perhaps someone has had their own experiences so that the wiki could be generalized and improved. @Molski @CGA @linux-aarhus
Why I’ve been using zstd:9 so far. I assumed:
- most file operations are reads.
- btrfs-zstd utilizes multiple cores(?). My system has 8 cores and 16 threads.
- with zstd, the time required to decompress reads hardly depends on the compression factor.
- with better compression, the read yields more data per decompressed block.
- most of the data I write is rather small.
- Compression also uses multiple threads(?) and benefits from my processor.
- A slow hard drive (like the one I had back then) benefits more from good compression because it definitely reads/writes data slower than zstd can process it.
- New arguments include:
- I now also have an NVMe drive (in RAID with a SATA SSD)
- The really large Manjaro updates can write several GB in a short time
- Generating the initrd also writes a lot of data at once
![]()
Tidied markdown to allow table to render. No charge.