Skip to main content

Module btrfs

Module btrfs 

Source
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:

  • label
  • devices/<name>: one symlink per member block device
  • devinfo/<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 fsid from the first of dirs containing a readable scrub.status.<fsid>.