ZFS Clarification on ZFS compression defaults and best practices

Hello everyone,

I have a question regarding the compression property in ZFS and I would appreciate some clarification.

I recently created a new ZFS pool with the following command, without specifying any particular options:
sh:
# zpool create mail da1 da2

When checking the compression settings on the mail dataset to compare it with the zroot dataset, I found the following:
Code:
# zfs get compression zroot mail
NAME   PROPERTY     VALUE           SOURCE
mail   compression  on              default
zroot  compression  lz4             local

From this, it appears that the mail dataset has the compression=on property, which, by default, should use lz4 (https://openzfs.github.io/openzfs-docs/Performance and Tuning/Workload Tuning.html#compression). However, I also noticed that the zroot dataset explicitly uses lz4 with the local source.

I have a couple of questions:
  1. Default compression method: Can someone confirm that the default compression=on property for a dataset, means ZFS automatically uses lz4 (at least in the most recent ZFS versions on FreeBSD)?
  2. Best practice for compression setting: Is it better to leave the compression property set to on (which i think defaults to lz4), particularly to avoid potential issues during future upgrades, or should I manually configure it to lz4 for clarity and consistency?
I am considering whether it's better to rely to ensure consistency across future ZFS upgrades or FreeBSD updates.

Code:
# zfs --version
zfs-2.2.6-FreeBSD_g33174af15
zfs-kmod-2.2.6-FreeBSD_g33174af15

Code:
# uname -r
14.2-RELEASE-p1

Thank you in advance for your insights and recommendations!
 
Not a comprehensive answer, but should give you an idea.
compression=on meant lzjb yesterday, means lz4 today and may mean something else tomorrow.
It's up to you to decide whether you want a fixed compression algorithm or 'the best' algorithm (according to some other people who make the decision).
 
Not a comprehensive answer, but should give you an idea.
compression=on meant lzjb yesterday, means lz4 today and may mean something else tomorrow.
It's up to you to decide whether you want a fixed compression algorithm or 'the best' algorithm (according to some other people who make the decision).
Thank tou Andriy for this clarification, but so i want to ask:

If I use compression=on, what happens to data that was compressed with the default algorithm (in this case, lz4) when a future ZFS version changes that default? Will the already written data stay compressed with the original algorithm, or will it be automatically recompressed using the new default?
Wouldn't it be wiser to explicitly set a specific compression algorithm (lz4, etc.) to ensure consistency and avoid potential confusion in the future?
This is for a production scenario.

Best regards
 
Will the already written data stay compressed with the original algorithm, or will it be automatically recompressed using the new default?
The changed setting would only apply to new writes. Same as turning compression on or off, it won't compress or decompress the existing data, only new data.
 
I for example use gzip to compress my datasets, and then put data into it.
But I am not quite sure which compression is better for which file extension type.
I have on my HDD ZFS RAID only FLACs, ISOs, and PDFs.
So, my question is, which compression should I use for these three file extension types ?
 
I for example use gzip to compress my datasets, and then put data into it.
But I am not quite sure which compression is better for which file extension type.
I have on my HDD ZFS RAID only FLACs, ISOs, and PDFs.
So, my question is, which compression should I use for these three file extension types ?

Flac - clearly no additional filesystem compression.

PDFs - most PDFs are already compressed these days, no I wouldn't add ZFS compression.

ISOs - depends on whats on them. A live FreeBSD ISO would be uncompressed, so it would benefit from filesystem compression. A FreeBSD install ISO is mostly comprised of pkgs, which are compressed.
 
Back
Top