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

From: Frank Leonhardt <freebsd-doc_at_fjl.co.uk>
Date: Thu, 18 Sep 2025 15:28:12 UTC
On 18/09/2025 11:10, Andrea Venturoli wrote:
> Hello.
>
> I've got a urgent trouble I'm trying to solve.
> I need to take backups of a server: they should be around 4-5 GBs, but 
> the end up close to 100GB!!!
>
> The trouble is with the zroot/ROOT/default dataset:
>> # cd /
>> # du -d 0 -h -x
>> 3.3G    .
>
> Yet:
>> root@chet:/ # zfs list|grep ROOT
>> zroot/ROOT                     70.9G  1.94T    88K  none
>> zroot/ROOT/default             70.9G  1.94T  62.1G  /
>
> So ho do we go from 3.3G to 62.1G???
> There are snapshots, but I'm using plain "zfs send", so they should 
> not matter...
>
>
>
>> # zfs get all zroot/ROOT/default
>> NAME                PROPERTY VALUE                     SOURCE
>> zroot/ROOT/default  type filesystem                -
>> zroot/ROOT/default  creation               Sun Dec 15 16:58 2019     -
>> <snip>
>> zroot/ROOT/default  keyformat none                      default
>> zroot/ROOT/default  pbkdf2iters 0                         default
>> zroot/ROOT/default  special_small_blocks 0                         
>> default
>> zroot/ROOT/default  snapshots_changed      Thu Sep 18 12:00:02 2025  -
>> zroot/ROOT/default  prefetch all                       default
>> zroot/ROOT/default  autobackup:auto_zroot true                      
>> inherited from zroot
>
>
>
> usedbydataset is 62.1G!!!
> Where can this come from if du says 3.3???
>
>
>
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.

Use "zfs list".

The REFERenced column is the amount of data accessible in the dataset 
and may be shared with other datasets. The Used column is the amount of 
space consumed by the dataset AND ALL IT'S DESCENDENTS and snapshots and 
suchlike.

Things like cloned datasets and block deduplication confuse matters even 
further. On later zpool versions (I assume yours is recent) you can get 
more detail with this:

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

The default zfs list properties are the tip of an iceberg!

Regards, Frank.