Bug 284087

Summary: ZFS: empty usage when -o readonly set on import
Product: Base System Reporter: Dmitry Morozovsky <marck>
Component: kernAssignee: freebsd-fs (Nobody) <fs>
Status: Open ---    
Severity: Affects Some People CC: asomers, markj
Priority: ---    
Version: 14.2-STABLE   
Hardware: Any   
OS: Any   

Description Dmitry Morozovsky freebsd_committer freebsd_triage 2025-01-15 18:15:56 UTC
mostly, subject said it all

found while reviving pool on a dying HDD: alloc and other related statistics are zero:

# zpool import -o readonly=on -R /mnt bext bext-old

# zpool list
NAME       SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
bext-old  3.62T      0  3.62T        -         -     0%     0%  1.00x    ONLINE  /mnt
# df -h | grep bext-old
bext-old/p/distfiles       3.1T    175G    3.0T     5%    /mnt/p/distfiles
bext-old/p/packages        3.3T    349G    3.0T    10%    /mnt/p/data/packages
Comment 1 Mark Johnston freebsd_committer freebsd_triage 2025-01-17 16:51:03 UTC
I see the same thing, it works fine if "-o readonly=on" is omitted:

> zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
data   10.9T  4.40T  6.47T        -         -     9%    40%  1.00x    ONLINE  -
zroot  1.80T   111G  1.69T        -         -     0%     6%  1.00x    ONLINE  -

with "data" imported using readonly=on:

> zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
data   10.9T      0  10.9T        -         -     0%     0%  1.00x    ONLINE  -
zroot  1.80T   111G  1.69T        -         -     0%     6%  1.00x    ONLINE  -

This might be worth reporting in the openzfs bug tracker as well.