Bug 273030

Summary: The ZFS default compression method described in the handbook is not zstd.
Product: Documentation Reporter: ykla <yklaxds>
Component: Books & ArticlesAssignee: freebsd-doc (Nobody) <doc>
Status: Closed Not A Bug    
Severity: Affects Only Me CC: allanjude, lwhsu
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description ykla 2023-08-09 17:59:06 UTC
The ZFS default compression method described in the handbook is not zstd.


The manual states that starting from FreeBSD 13.0, the default compression algorithm for the installed ZFS has been changed to zstd. However, this change has not been applied; I installed FreeBSD 13.2-RELEASE and 14.0, and the default parameters are still lz4. Is the issue here with the documentation or with the default installation image?

-------------------------------
Handbook https://docs.freebsd.org/en/books/handbook/zfs/#zfs-zfs
22.4.11. Zstandard Compression
OpenZFS 2.0 added a new compression algorithm. Zstandard (Zstd) offers higher compression ratios than the default LZ4 while offering much greater speeds than the alternative, gzip. OpenZFS 2.0 is available starting with FreeBSD 12.1-RELEASE via sysutils/openzfs and has been the default in since FreeBSD 13.0-RELEASE.
Comment 1 Li-Wen Hsu freebsd_committer freebsd_triage 2023-08-10 04:46:31 UTC
I think there are two things here. If you're talking about the default compression setting of the zfs on root done by the bsdinstall, in 

  usr.sbin/bsdinstall/scripts/zfsboot

which is indeed set to lz4:

  : ${ZFSBOOT_POOL_CREATE_OPTIONS:=-O compress=lz4 -O atime=off}

We can discuss if we want to change it to zstd.

On the other hand, the default compression algorithm of OpenZFS, is still lz4 when lz4_compress feature is enabled (and which is the default.)

This is in the OpenZFS doc:

  https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#compression

and so as the imported https://man.freebsd.org/zfsprops/7

Finally, you may misinterpret that paragraph. What it describes is that OpenZFS 2.0 is the default since FreeBSD 13.0, and thus zstd is an available option, not the default compression algorithm is changed.
Comment 2 Allan Jude freebsd_committer freebsd_triage 2023-08-10 13:53:43 UTC
It does not state zstd is the default, just that support for it was introduced.

ZSTD is more expensive, and should not be the default.

All it says is ZSTD offers better compression than the default, which is LZ4.
You still have to opt-in to it.