Re: [List] Cannot find out what uses space in ZFS dataset

From: David Christensen <dpchrist_at_holgerdanske.com>
Date: Fri, 19 Sep 2025 00:53:20 UTC
On 9/18/25 08:57, Andrea Venturoli wrote:
> On 9/18/25 17:28, Frank Leonhardt wrote:
> 
> Thanks a lot for answering.
> 
>> First - and I can't say this often enough - ignore du with zfs! It 
>> produces a figure for backward compatibility purposes but it's not 
>> good at dealing with zfs concepts like compression.
> 
> Well...
> I agree with you if the goal is finding out disk occupation.
> However what I'm trying to do is "zfs send" 
> <snip>


Please post the console session.  zfs-send(8) has several modes of 
operation, depending upon options and arguments.


>> zfs list -t all -o 
>> name,refer,used,usedbychildren,usedbydataset,usedbyrefreservation,usedbysnapshots


Root-on-ZFS includes a hierarchy of nested filesystems.  RTFM 
zfs-list(8) you need the option "-r" (recursive) to see them all:

# zfs list -r -t all -o 
name,refer,used,usedbychildren,usedbydataset,usedbyrefreservation,usedbysnapshots


On 9/18/25 10:39, Andrea Venturoli wrote:
 > On 9/18/25 18:44, freebsd@vanderzwan.org wrote:
 >
 >>>> zroot/ROOT/default@auto_zroot-20250611020000            3.34G
 >>>> 209M          -       -              -         -
 >>>> zroot/ROOT/default@auto_zroot-20250711020000            62.2G
 >>>> 407M          -       -              -         -
 >>
 >> Here the refer jumps from 3.34 to 62.2 GB, so it looks like your
 >> missing data is in this snapshot.
 >
 > Hmmm...
 >
 >> # zfs list  -o name,refer,used,usedbysnapshots|grep default
 >> zroot/ROOT/default             62.1G  70.5G     8.36G
 >
 > usedbysnapshots is 8.36G, so I guess this single snapshot cannot take 
60GB.


RTFM zfsprops(7):

      usedbysnapshots       The amount of space consumed by snapshots of
                            this dataset.  In particular, it is the
                            amount of space that would be freed if all of
                            this dataset's snapshots were destroyed.
                            Note that this is not simply the sum of the
                            snapshots' used properties because space can
                            be shared by multiple snapshots.


AIUI 8.36G is the amount of space used by snapshots of the dataset 
"zroot/ROOT/default" alone.  It does not include the amount of space 
used by snapshots of child datasets.


 > Also "zfs send" doesn't transmit snapshots,


RTFM zfs-send(8):

      zfs send [-DLPVRbcehnpvw] [[-I|-i] snapshot] snapshot
        Creates a stream representation of the second snapshot, which is
        written to standard output.  The output can be redirected to a
        file or to a different system (for example, using ssh(1)).  By
        default, a full stream is generated.


AIUI `zfs send ...` transmits snapshots.


 > I tried deleting the 20250711020000 snapshot.
 > <snip>
 > Still "zfs send" generates the same huge amount of data.


Please post the console session.  My guess is that you destroyed the 
snapshot in the dataset "zroot/ROOT/default", but that you did not 
destroy the snapshots in the child datasets.


David