ZFS works as intended, here. Zero-filled blocks are not counted into the
compression ratio, as they get dismissed early in the compression
pipeline and never hit the disks as used data:

# zfs create sbblht/test

# dd if=/dev/zero of=/test/a bs=16M count=8
8+0 records in
8+0 records out
134217728 bytes (134 MB, 128 MiB) copied, 0.0718708 s, 1.9 GB/s

root@sbooblehat:~# du -shx /test/
1.0K    /test/

root@sbooblehat:~# du -shx --apparent-size /test/
129M    /test/

# zfs list -o used,logicalused,ratio sbblht/test
 USED  LUSED  RATIO
  19K  9.50K  1.00x

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to zfs-linux in Ubuntu.
https://bugs.launchpad.net/bugs/1639963

Title:
  zfs get compressratio returns bogus results

Status in zfs-linux package in Ubuntu:
  Invalid

Bug description:
  I'm running a just-installed-today copy of 16.04.1, installed from an
  ISO also just downloaded today from releases.ubuntu.com.

  root@xenial:~# lsb_release -rd
  Description:  Ubuntu 16.04.1 LTS
  Release:      16.04

  root@xenial:~# apt-cache policy zfsutils-linux
  zfsutils-linux:
    Installed: 0.6.5.6-0ubuntu14
    Candidate: 0.6.5.6-0ubuntu14
    Version table:
   *** 0.6.5.6-0ubuntu14 500
          500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 
Packages
          100 /var/lib/dpkg/status
       0.6.5.6-0ubuntu8 500
          500 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages

  I noticed that zfs get compressratio was not returning good results,
  and tested to ensure it was the compressratio reporting that was
  broken, not the actual compression.  Demonstration:

  root@xenial:~# zfs get compress data/test
  NAME       PROPERTY     VALUE     SOURCE
  data/test  compression  gzip      local
  root@xenial:~# zfs list data/test
  NAME        USED  AVAIL  REFER  MOUNTPOINT
  data/test  2.64G   855G  2.64G  /data/test

  Note that data/test has inline gzip compression on, and shows 2.64G of
  data USED.

  root@xenial:~# du -hs --apparent-size /data/test
  9.2G  /data/test
  root@xenial:~# du -hs /data/test
  2.7G  /data/test

  Now note that du correctly shows us that we have 9.2G of data stored
  in data/test (about 7G of which is actually a dump from /bin/zero for
  max compressibility, the other bit being an Ubuntu VM image file).

  We should be seeing a compressratio of about 3.41x.

  root@xenial:~# zfs get compressratio data/test
  NAME       PROPERTY       VALUE  SOURCE
  data/test  compressratio  1.01x  -

  But we're seeing 1.01x.  Obviously very much not correct.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/zfs-linux/+bug/1639963/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to