Compressing ZFS File Systems

Compression is the process where data is stored using less disk space. The following compression algorithms are available:

  • gzip - standard UNIX compression.

  • gzip-N - selects a specific gzip level. gzip-1 provides the fastest gzip compression. gzip-9 provides the best data compression. gzip-6 is the default.

  • lz4 - provides better compression with lower CPU overhead

  • lzjb - optimized for performance while providing decent compression

  • zle - zero length encoding is useful for datasets with large blocks of zeros

Note:

Currently, neither lz4 or gzip compression is supported on root pools.

You can choose a specific compression algorithm by setting the compression ZFS property. To use the LZ4 algorithm, use a command like the following:

$ zfs set compress=lz4 pool/fs