ZFS Compression: Difference between revisions

From Lustre Wiki
Jump to navigation Jump to search
(Created page with "Notes on enabling and working with zfs compression We assume this is for zfs on lustre, but will work the same for standalone zfs. To do this on a lustre/zfs system, you have...")
 
No edit summary
Line 7: Line 7:
<STORAGE> = the pool, filesystem, or directory you choose.
<STORAGE> = the pool, filesystem, or directory you choose.


# Check ZFS compression
== Check ZFS compression ==
   
   
<pre>zfs get compression <STORAGE></pre>
<pre>zfs get compression <STORAGE></pre>
   
   
# Set ZFS compression
== Set ZFS compression ==


<pre>zfs set compression=on <STORAGE></pre>
<pre>zfs set compression=on <STORAGE></pre>
Line 23: Line 23:
I think you might only need to set this on pools, and filesystems should inherit, but to be safe, you can apply it to everything.
I think you might only need to set this on pools, and filesystems should inherit, but to be safe, you can apply it to everything.
   
   
# Check compression ratio
== Check compression ratio ==
   
   
<pre>zfs get compressratio <STORAGE></pre>
<pre>zfs get compressratio <STORAGE></pre>

Revision as of 19:05, 30 April 2015

Notes on enabling and working with zfs compression

We assume this is for zfs on lustre, but will work the same for standalone zfs. To do this on a lustre/zfs system, you have to perform these commands on every OST in the system. I would definitely not bother doing this on metadata.

'NOTE - here I'll assume you always work on a whole pool or filesystem, but these commands should work on any arbitrary directory too.

<STORAGE> = the pool, filesystem, or directory you choose.

Check ZFS compression

zfs get compression <STORAGE>

Set ZFS compression

zfs set compression=on <STORAGE>

turns on compression with default algorithm (lzjb). You can chose values other than "on" for the compression algorithm, see 'man zfs' for details.

To use a different algorithm, use for example "compression=lz4" instead of "on".

lz4 is likely the best choice now. It has been tested extensively, and provides very good compression balanced with performance. Basically, it stops trying to compress after compressing some initial part of the data and getting poor results. Details from experts on this topic is needed

I think you might only need to set this on pools, and filesystems should inherit, but to be safe, you can apply it to everything.

Check compression ratio

zfs get compressratio <STORAGE>