Source total capacity multiplied by number of ZFS child datasets (v2.0.9-beta, regression from #2761)
Description
On TrueNAS SCALE 24 (ZFS), a source whose path is a ZFS pool root reports a total capacity of roughly N × pool size, where N is the number of child datasets mounted under that path. Every ZFS dataset is its own mount with its own device ID, but statfs on each one reports the whole pool's free space, so the pool's capacity is counted once per dataset.
This is the same root cause as #2997, which was closed as a duplicate of #2761. The #2761 change (v2.0.7, summing statfs across nested mounts under the source root) is what introduces this behaviour for ZFS rather than fixing it. Opening this one because the visible symptom is the inflated total rather than a >100% percentage.
Expected behaviour
A source at /srv/pool (bind mount of /mnt/pool) should show the pool's real capacity: ~36 TB, as zpool list reports.
What is happening instead?
The sidebar shows ~550 TB total for the same source. The used figure is roughly correct; the total is ~15× the pool size, so the percentage is far too low. No errors in the logs.
The arithmetic matches exactly: 26 mounted datasets under the source root, each reporting ~19.7 TB available → 26 × 19.7 TB ≈ 512 TB, plus the summed used bytes ≈ 550 TB.
Version: v2.0.9-beta (gtstef/filebrowser:beta)
Additional context
GetAggregatedPartitionUsage (partition_aggregate_linux.go) dedupes by major:minor from /proc/self/mountinfo. ZFS assigns a unique device ID to every dataset even though they share one pool, so nothing is deduped. Possible fixes:
- When
fstype == zfs, dedupe by pool name (the first path component of the mountSOURCE, e.g.pool/a/b→pool) and take one statfs for the pool root - Or dedupe by
statfs.f_fsidinstead of major:minor - Or a per-source option to skip nested mounts and only statfs the source root
How to reproduce?
- Create a ZFS pool with a few child datasets:
zfs create pool/a,zfs create pool/b,zfs create pool/a/c(or use any TrueNAS pool with datasets) - Bind-mount the pool root into the container:
- /mnt/pool:/srv/pool - Configure a source with
path: /srv/pool - Compare the sidebar total against
zpool list pool: it is multiplied by the number of mounted datasets
Files
findmnt -R /mnt/pool -o TARGET,SOURCE,FSTYPE (dataset names redacted; 26 mounts in total):
TARGET SOURCE FSTYPE
/mnt/pool pool zfs
├─/mnt/pool/ds01 pool/ds01 zfs
│ ├─/mnt/pool/ds01/a pool/ds01/a zfs
│ ├─ ... (16 child datasets)
├─/mnt/pool/ds02 pool/ds02 zfs
├─ ... (9 first-level datasets)
└─/mnt/pool/ds09 pool/ds09 zfszpool list pool:
NAME SIZE ALLOC FREE CAP HEALTH
pool 36.4T 15.9T 20.5T 43% ONLINEzfs list pool -o name,used,avail:
NAME USED AVAIL
pool 16.5T 19.7Tconfig.yaml:
server:
cacheDir: /home/filebrowser/data/tmp
sources:
- name: pool
path: /srv/pool
config:
defaultEnabled: trueSource: gtsteffaniak/filebrowser