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

From: <freebsd_at_vanderzwan.org>
Date: Fri, 19 Sep 2025 10:08:50 UTC

> On 19 Sep 2025, at 09:22, Andrea Venturoli <ml@netfence.it> wrote:
> 
> On 9/18/25 21:50, freebsd@vanderzwan.org wrote:
> 
>> One thing that could explain this difference between du and zfs used is if you mount a small/empty filesystem on top of a very large directory.
> > In that case the content of the directory would be invisible because the mount masks it.
> 
> Doh!
> I hadn't thought about this! That's quite obvious and it even happened to me a few times in the past!
> 
> Following a suggestion on a forum, I tried:
>> mkdir /mnt/test
>> mount -t nullfs / /mnt/test
> but what I see under /mnt/test is identical to what I see under /.
> 
> The suggestion above was for UFS. I guess it works with ZFS too. Doesn't it?
> 
> 
> 
>> Does the output of the mount command show any strange mounts that could cause this ?
> 
> Nothing.
> 
> 
> 
>> About the du output what does ‘du -mx / |sort -n |tail ‘ show ?
> 
>> # du -mx / |sort -n |tail
>> 238     /usr/local/lib/python3.11
>> 442     /usr/lib/debug/boot
>> 539     /usr/local/lib
>> 567     /usr/lib/debug/usr/bin
>> 758     /usr/lib/debug/usr
>> 1229    /usr/local
>> 1235    /usr/lib/debug
>> 1371    /usr/lib
>> 3051    /usr
>> 3394    /
> 
> That's coherent with my earlier du output.
> 


What you could do is to find largest objects in the dataset using zdb:
zdb -ddd zroot/ROOT/default 0:-1:A |sort -h -b -k 5 |tail

that should show you the largest objects in the dataset.
First column is the object id which is also the inode number.

You can find more info on the objects using:
zdb -ddd zroot/ROOT/default OBJECTID

You can try to find the name using :
find / -xdev -inum OBJECTID

But if du cannot see it I doubt find can find it.
But this would at least show you if there are large objects in the dataset using lot of space.

Cheers,
	Paul