Skip to content

Instantly share code, notes, and snippets.

@dlangille
Created April 3, 2018 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlangille/bcf918b22aaf9b3fd17408b39c97e8ce to your computer and use it in GitHub Desktop.
Save dlangille/bcf918b22aaf9b3fd17408b39c97e8ce to your computer and use it in GitHub Desktop.
Enabling compression on ZFS - a practical example
After enabling compression:
[dan@zuul:~] $ zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
system 452G 365G 87.5G - 52% 80% 1.00x ONLINE -
I had this large file:
-rw-r----- 1 rsyncer rsyncer 68630478685 Apr 3 09:12 bacula.dump
I copied it:
[rsyncer@zuul ~/backups/Bacula]$ cp bacula.dump bacula.dump.compressed
I checked space:
[dan@zuul:~] $ zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
system 452G 372G 79.5G - 54% 82% 1.00x ONLINE -
That's a 63GB file copied, and using only 8G or so.
Now lets move it back:
[rsyncer@zuul ~/backups/Bacula]$ mv bacula.dump.compressed bacula.dump
A short while later:
[dan@zuul:~] $ zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
system 452G 306G 146G - 46% 67% 1.00x ONLINE -
Wow! Another 66G of free space. We went from 82% full to 67% full.
Moral: Always turn compression on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment