[pve-devel] [PATCH v2 docs 1/3] Add section 'Compression in ZFS'

Fabian Ebner f.ebner at proxmox.com
Thu Jan 16 13:15:44 CET 2020

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>

Thanks to Thomas and Aaron for their suggestions.

Changes from v1:
    * Moved paragraph to serve as introduction
    * ZFS might not compress blocks that aren't compressible
      enough (7/8 of original size is the threshold)
      so I used "tries to compress" instead
    * Fixed typo
    * 2 other patches improving style/fixing typos

 local-zfs.adoc | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/local-zfs.adoc b/local-zfs.adoc
index 15a88bb..7043a24 100644
--- a/local-zfs.adoc
+++ b/local-zfs.adoc
@@ -180,7 +180,7 @@ underlying disk.
  zpool create -f -o ashift=12 <pool> <device>
-To activate compression
+To activate compression (see section <<zfs_compression,Compression in ZFS>>):
  zfs set compression=lz4 <pool>
@@ -433,6 +433,35 @@ change-key` commands and the `Encryption` section from `man zfs` for more
 details and advanced usage.
+Compression in ZFS
+When compression is enabled on a dataset, ZFS tries to compress all *new*
+blocks before writing them and decompresses them on reading. Already
+existing data will not be compressed retroactively.
+You can enable compression with:
+# zfs set compression=<algorithm> <dataset>
+We recommend using the `lz4` algorithm, because it adds very little CPU
+overhead. Other algorithms like `lzjb` and `gzip-N`, where `N` is an
+integer from `1` (fastest) to `9` (best compression ratio), are also
+available. Depending on the algorithm and how compressible the data is,
+having compression enabled can even increase I/O performance.
+You can disable compression at any time with:
+# zfs set compression=off <dataset>
+Again, only new blocks will be affected by this change.
 ZFS Special Device

More information about the pve-devel mailing list