Expand description
btrfs filesystem health from /sys/fs/btrfs/<fsid>.
Everything read here is world-readable, so RAID profile, allocation and
per-device error counters are available without root. (btrfs device stats needs root and offers the same counters.)
Layout used:
labeldevices/<name>: one symlink per member block devicedevinfo/<devid>/missing,devinfo/<devid>/error_stats
sysfs has no devid-to-name mapping, so device names come from the
BTRFS_IOC_DEV_INFO ioctl on a mount point, which needs no root either.
allocation/<data|metadata|system>/<profile>/{total_bytes,used_bytes}
Scrub results are not in sysfs: btrfs-progs keeps them in
/var/lib/btrfs/scrub.status.<fsid> (mode 0600). The root collector in
contrib/collect/ copies that file to a world-readable directory; see
read_scrub.
Constants§
- BTRFS_
PROGS_ STATUS_ DIR - Where btrfs-progs itself writes scrub status files (readable by root only).
Functions§
- read_
filesystems - Reads every btrfs filesystem known to the kernel and attaches mount points
from
mounts. - read_
scrub - Reads the last scrub result of filesystem
fsidfrom the first ofdirscontaining a readablescrub.status.<fsid>.