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 ~~~~~~~~~~~~~~~~~~