How do I enable GZIP compression?

Hii there,

I switched from FreeNAS to Rockstor today, because FreeNAS was bugging all over the place.
However, after I started dropping all files on the NAS again, I noticed my HDD space usage was way higher than that from FreeNAS.
Upon looking a bit into it, I noticed that I had ZLIB enabled, not GZIP.
When I tried to enable GZIP in the GUI, it wasn’t there.
How can I enable GZIP?
I really need this, because else my files won’t fit on the drive.

Cheers.

Zlib and lzo compression is available in btrfs.
https://btrfs.wiki.kernel.org/index.php/Compression

Zlib = gzip if I’m not mistaking

Sorry, I was confusing ZLIB with ZLE.
But the gzip in FreeNAS gives me a way higher compression ratio (with the same files) how can I make it compress even harder?
Performance is no issue here.

BTRFS will only compress if it can save a descent amount of space doing so. This is for performance.
There is another mount option that will force compression but it’s not available from rockstor webui.
I guess that will be the main differance from your FreeNAS setup.

You could try and play with this on the extra mount options. “compress-force=zlib”

_compress,compress-force _
Enable compression. Starting with kernel 2.6.38 you can choose the algorithm for compression:
compress=zlib - Better compression ratio. It’s the default and safe for olders kernels.
compress=lzo - Faster compression.
compress=no - Disables compression (starting with kernel 3.6).
compress-force= - Enable compression even for files that don’t compress well, like videos and dd images of disks. The options compress-force=zlib and compress-force=lzo works for kernels >2.6.38.
Note that old (before 2012) btrfs-progs versions will probably fail some operations (e.g. fsck) on filesystems with LZO compression.

https://btrfs.wiki.kernel.org/index.php/Mount_options

Thanks, I’ve done that and I think it works.

Hello,
As compression is important for you i think you will find this interesting.
New compression option is getting added to btrfs in future kernel releases (ZSTD).
It can compress better than zlib and at the same time have better speed.

Here is a summary of ratio and speed:

| Method  | Ratio | Compression MB/s | Decompression speed |
|---------|-------|------------------|---------------------|
| None    |  0.99 |              504 |                 686 |
| lzo     |  1.66 |              398 |                 442 |
| zlib    |  2.58 |               65 |                 241 |
| zstd 1  |  2.57 |              260 |                 383 |
| zstd 3  |  2.71 |              174 |                 408 |
| zstd 6  |  2.87 |               70 |                 398 |
| zstd 9  |  2.92 |               43 |                 406 |
| zstd 12 |  2.93 |               21 |                 408 |
| zstd 15 |  3.01 |               11 |                 354 |

Ref: http://lists-archives.com/linux-kernel/28860806-btrfs-add-zstd-support.html

In terms of availability, 7zip is widely available across UNIX (Linux/BSD/MacOS) and Windows systems. Therefore a zip file is highly portable. xz and 7zip are known to have a better compression algorithm than gzip, but use more memory and time to compress/decompress. when backing up I would recommend tar.7z as it has the highest compression rate saving you space but uses an extra program (7zip). .tar.gz will be larger files and do the same job, you could also use bzip (.tar.bz/bz2) although i’m not sure if that would suit you better as I use gzip or 7zip