SOLVED what do the compression ratio numbers in FreeNAS mean?

Status
Not open for further replies.

devnullius

Patron
Joined
Dec 9, 2015
Messages
289
What does it mean to have a compression ratio of 1.09 on ZFS FreeNAS system? I couldn't find an abvious answer, so I googled a bit. I found an answer here: https://pthree.org/2012/12/18/zfs-administration-part-xi-compression-and-deduplication/

Now that we've enabled compression on this dataset, let's copy over some uncompressed data, and see what sort of savings we would see. A great source of uncompressed data would be the /etc/ and /var/log/ directories. Let's create a tarball of these directories, see it's raw size and see what sort of space savings we achieved:
tank/test compressratio 2.14x -

So, in my case, I created a 24 MB uncompressed tarball. After copying it to the dataset that had compression enabled, it only occupied 11.1 MB. This is less than half the size (text compresses very well)! We can read the "compressratio" property on the dataset to see what sort of space savings we are achieving. In my case, the output is telling me that the compressed data would occupy 2.14 times the amount of disk space, if uncompressed. Very nice.

All in all an interesting article to read (it talks about deduplication too).

Small remaining question: can I tweak the GUI to not show 1.04 but 96% instead? Makes more sense to me :)

Peace!

Devnullius
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Small remaining question: can I tweak the GUI to not show 1.04 but 96% instead?
Think a little about this, though. A number of 1.09x means that you're storing 1.09x as much data as you're using drive space--you're using 1000 MB of pool space to store 1090 MB of data. If you use a percentage, like 96%, does that mean the data is compressed to 96% of its original size (1000 MB of data is taking 960 MB of pool space), or the data is compressed by 96% (1000 MB of data is taking 40 MB of pool space)? IMO, the multiplier is less ambiguous.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
The multiplier is also not linear. A 2.00x multiplier means your data is taking up 1/2 the space. So no, bad idea (in my opinion) and the multiplier is the best way to display the compression ratio. :D
 

devnullius

Patron
Joined
Dec 9, 2015
Messages
289
Ok, I'll adjust ;p

:) Thanks for the feedback
 

bal

Cadet
Joined
Jul 21, 2014
Messages
1
beside the % vs Ratio it doesn't match, I have a test server 9.3 (to test upgrade) with only one file (file extend for esx storage) of 200Gb reported size from ls -lh , but when I check the storage it tel me that I use 35Gb and have a ratio of 1.95
so either the usage should be around 100gb or the file around 75gb??
Doesn't realy bother me but just curious
 

Robert Trevellyan

Pony Wrangler
Joined
May 16, 2014
Messages
3,778
Note also that in a dataset with compression enabled, empty (all zero) blocks are not allocated, take up essentially no space, and are not counted in the compression ratio. That's why you can store, say, a 1TB disk image on ZFS, with, say, a 1.4:1 compression ratio, but have it only occupy a few hundred GB. The compression ratio is only calculated for the blocks that are allocated.
 
Status
Not open for further replies.
Top