statvfs · shipping · also fstatvfs

statvfs

statvfs reports mounted-filesystem statistics for a pathname, while fstatvfs queries through an open file descriptor.

Related Observatory article: Read on hesela.com

f_bfree counts free blocks and f_bavail those available to unprivileged users; their byte unit is f_frsize. f_ffree and f_favail count inodes separately. Field meanings are not guaranteed for every filesystem. [1]

Linux v6.8 XFS can adjust the results for project quotas when project inheritance, accounting and enforcement apply. Availability is therefore not universally a whole-filesystem count or a per-user quota allowance. [2] [3] The helper prefers a nonzero soft limit over the hard limit and does not consult the grace timer; its count is not a grace-period verdict. [3]

A free-space report also depends on how its count was obtained. Linux v6.12 documents usefree as an opt-in reuse of the FAT32 FSInfo count instead of scanning allocation. This is an implementation-specific policy, not a universal statvfs guarantee. The separate FatFs experiment is not a Linux statvfs measurement. [5] [6]

In Linux v6.12 ext4, ordinary f_bavail accounting subtracts configured reserved blocks and an internal reserve, with a floor of zero; it does not adjust for the caller's reserved-block privileges. Project-quota adjustment can then replace the counters. Thus f_bfree minus f_bavail is not universally the configured reserved-block count. [7] The allocation check separately considers the reserved user, membership of a configured nonzero reserved group, CAP_SYS_RESOURCE and internal flags. Zero ordinary availability need not prohibit every allocation, but eligible credentials do not guarantee write success. [8]

Relations

related
Filesystem quota, Inode, File preallocation, Thin provisioning, FAT cluster chain, Ext4, Filesystem allocation unit, Filesystem block

Limitations

  • A capacity query does not reserve a file range or establish that a later write will succeed. [1, 4]

Citations

  1. Linux man-pages: statvfs(3), block units and availability counters (accessed 2026-10-21)
  2. Linux v6.8: XFS statfs project-scope selection (accessed 2026-10-21)
  3. Linux v6.8: XFS quota-adjusted filesystem counters (accessed 2026-10-21)
  4. Hesela: filesystem quotas and capacity headroom (accessed 2026-10-21)
  5. Linux v6.12 VFAT documentation: usefree (accessed 2026-10-25)
  6. Hesela: FatFs R0.16 FSInfo experiment, original captures and reproduction instructions (accessed 2026-10-25)
  7. Linux v6.12: ext4_statfs reserve accounting and project-quota adjustment (accessed 2026-11-01)
  8. Linux v6.12: ext4_has_free_clusters credential and internal-reserve checks (accessed 2026-11-01)

Further reading

  1. e2fsprogs tune2fs(8): reserved-block count, percentage, user and group (accessed 2026-11-01)
Sources & caveats
  • API and implementation source review; no quota-exhaustion experiment. [4]

JSON: /data/terms/statvfs.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. statvfs. Hesela. 2026-11-01. https://hesela.dev/terms/statvfs/