It is by design.  The idea is to report the dedup ratio for the data
you've actually attempted to dedup.  To get a 'diluted' dedup ratio
of the sort you describe, just compare the space used by all datasets
to the space allocated in the pool.  For example, on my desktop,
I have a pool called 'builds' with dedup enabled on some datasets:

$ zfs get used builds
NAME    PROPERTY  VALUE  SOURCE
builds  used      81.0G  -
$ zpool get allocated builds
NAME    PROPERTY   VALUE  SOURCE
builds  allocated  47.4G  -

Thus my diluted dedup ratio is 81.0 / 47.4 = 1.71.

Jeff

On Sat, Dec 12, 2009 at 10:06:49PM +0000, Robert Milkowski wrote:
> Hi,
> 
> The compressratio property seems to be a ratio of compression for a 
> given dataset calculated in such a way so all data in it (compressed or 
> not) is taken into account.
> The dedupratio property on the other hand seems to be taking into 
> account only dedupped data in a pool.
> So for example if there is already 1TB of data before dedup=on and then 
> dedup is set to on and 3 small identical files are copied in the 
> dedupratio will be 3. IMHO it is misleading as it suggest that on 
> average a ratio of 3 was achieved in a pool which is not true.
> 
> Is it by design or is it a bug?
> If it is by design then having an another property which would give a 
> ratio of dedup in relation to all data in a pool (dedupped or not) would 
> be useful.
> 
> 
> Example (snv 129):
> 
> 
> mi...@r600:/rpool/tmp# mkfile 200m file1
> mi...@r600:/rpool/tmp# zpool create -O atime=off test /rpool/tmp/file1
> 
> mi...@r600:/rpool/tmp# ls -l /var/adm/messages
> -rw-r--r-- 1 root root 70993 2009-12-12 21:50 /var/adm/messages
> mi...@r600:/rpool/tmp# cp /var/adm/messages /test/
> mi...@r600:/rpool/tmp# sync
> mi...@r600:/rpool/tmp# zfs get compressratio test
> NAME  PROPERTY       VALUE  SOURCE
> test  compressratio  1.00x  -
> 
> 
> mi...@r600:/rpool/tmp# zfs set compression=gzip test
> mi...@r600:/rpool/tmp# cp /var/adm/messages /test/messages.1
> mi...@r600:/rpool/tmp# sync
> mi...@r600:/rpool/tmp# zfs get compressratio test
> NAME  PROPERTY       VALUE  SOURCE
> test  compressratio  1.27x  -
> 
> 
> mi...@r600:/rpool/tmp# zfs get compressratio test
> NAME  PROPERTY       VALUE  SOURCE
> test  compressratio  1.24x  -
> 
> 
> 
> 
> 
> mi...@r600:/rpool/tmp# zpool destroy test
> mi...@r600:/rpool/tmp# zpool create -O atime=off test /rpool/tmp/file1
> mi...@r600:/rpool/tmp# zpool get dedupratio test
> NAME  PROPERTY    VALUE  SOURCE
> test  dedupratio  1.00x  -
> 
> 
> mi...@r600:/rpool/tmp# cp /var/adm/messages /test/
> mi...@r600:/rpool/tmp# sync
> mi...@r600:/rpool/tmp# zpool get dedupratio test
> NAME  PROPERTY    VALUE  SOURCE
> test  dedupratio  1.00x  -
> 
> mi...@r600:/rpool/tmp# cp /var/adm/messages /test/messages.1
> mi...@r600:/rpool/tmp# sync
> mi...@r600:/rpool/tmp# zpool get dedupratio test
> NAME  PROPERTY    VALUE  SOURCE
> test  dedupratio  1.00x  -
> mi...@r600:/rpool/tmp# cp /var/adm/messages /test/messages.2
> mi...@r600:/rpool/tmp# sync
> mi...@r600:/rpool/tmp# zpool get dedupratio test
> NAME  PROPERTY    VALUE  SOURCE
> test  dedupratio  2.00x  -
> 
> mi...@r600:/rpool/tmp# rm /test/messages
> mi...@r600:/rpool/tmp# sync
> mi...@r600:/rpool/tmp# zpool get dedupratio test
> NAME  PROPERTY    VALUE  SOURCE
> test  dedupratio  2.00x  -
> 
> 
> 
> 
> 
> 
> 
> -- 
> Robert Milkowski
> http://milek.blogspot.com
> 
> _______________________________________________
> zfs-discuss mailing list
> zfs-discuss@opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to