Check efficiency of lz4 compression in ZFS

Discussion in 'Solaris, Nexenta, OpenIndiana, and napp-it' started by daisho, Nov 26, 2019.

  1. daisho

    daisho New Member

    Joined:
    Apr 25, 2019
    Messages:
    20
    Likes Received:
    1
    Hi,

    is it possible to see the real space usage of a file in ZFS when e.g. lz4 compression is enabled?
    When I do a ls -l of a folder it looks like it shows the non-compressed size (or compression is completely ineffective for those files) though.

    Anyone already hampered with that kind of stuff?

    Thanks,
    daisho
     
    #1
  2. gea

    gea Well-Known Member

    Joined:
    Dec 31, 2010
    Messages:
    2,273
    Likes Received:
    752
    You can check compressratio for all filesystems
    zfs get compressratio

    for a single filesystem ex
    zfs get compressratio tank/data

    btw
    if you enable compress, this will only affect newly written or modified datablocks
     
    #2
  3. daisho

    daisho New Member

    Joined:
    Apr 25, 2019
    Messages:
    20
    Likes Received:
    1
    Thanks, current ratio is 1.00 because apparently I have to enable the feature also on the ZFS filesystem and not only the pool :(
    (/edit: or at least it is not sufficient that the pool lists the feature as activated)
     
    #3
  4. vanfawx

    vanfawx Active Member

    Joined:
    Jan 4, 2015
    Messages:
    304
    Likes Received:
    52
    zfs get compressratio,used,logicalused

    This will get you the compression ratio, how much it's actually using on disk, and how much it would be using if not for compression.
     
    #4
  5. thulle

    thulle New Member

    Joined:
    Apr 11, 2019
    Messages:
    14
    Likes Received:
    7
    Use "ls -lks"

    Writing two 1MiB files to disk, one all nulldata and one half nulldata and half random data then shows:

    Code:
      1 -rw-r--r-- 1 thulle thulle 1048576 27 nov 16.21 zero
    529 -rw-r--r-- 1 thulle thulle 1048576 27 nov 16.21 zero2
    
    The allocated space is the first number, 1KiB for the nulldata and 529KiB when half of it is random data.
     
    #5
  6. daisho

    daisho New Member

    Joined:
    Apr 25, 2019
    Messages:
    20
    Likes Received:
    1
    Thanks to you both. Now that I've actually enabled lz4 compression I can see the different ratios (on rpool it was enabled already).
     
    #6
Similar Threads: Check efficiency
Forum Title Date
Solaris, Nexenta, OpenIndiana, and napp-it Checking complete disks for errors in OmniOS Nov 9, 2019
Solaris, Nexenta, OpenIndiana, and napp-it ZFS checksum error (on scrub) – how do I see affected files? Jun 30, 2019
Solaris, Nexenta, OpenIndiana, and napp-it Unable to get past checksum(s) error when installing All-in-one Mar 18, 2019
Solaris, Nexenta, OpenIndiana, and napp-it napp it nfs subtree_check Dec 23, 2016
Solaris, Nexenta, OpenIndiana, and napp-it New Ransomware tactic: First check backups and infrastructure, then encrypt Mar 30, 2016

Share This Page