From e06707f2d1c22fc50bfa08a332c2d262dff27050 Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Thu, 16 Jan 2020 13:15:44 +0100 Subject: [PATCH] Add section 'Compression in ZFS' Signed-off-by: Fabian Ebner --- 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 -To activate compression +To activate compression (see section <>): zfs set compression=lz4 @@ -433,6 +433,35 @@ change-key` commands and the `Encryption` section from `man zfs` for more details and advanced usage. +[[zfs_compression]] +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= +---- + +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 +---- + +Again, only new blocks will be affected by this change. + + ZFS Special Device ~~~~~~~~~~~~~~~~~~ -- 2.39.2