{
  "slug": "statvfs",
  "term": "statvfs",
  "aliases": [
    "fstatvfs"
  ],
  "definition": "statvfs reports mounted-filesystem statistics for a pathname, while fstatvfs queries through an open file descriptor.",
  "note": "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. [statvfs]\n\nLinux 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. [xfs-statfs] [xfs-quota-counters] 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. [xfs-quota-counters]\n\nA 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. [vfat-usefree] [fatfs-evidence]\n\nIn 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. [ext4-reserve-statfs] 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. [ext4-reserve-allocation]",
  "status": "shipping",
  "advantages": [],
  "limitations": [
    {
      "text": "A capacity query does not reserve a file range or establish that a later write will succeed.",
      "citationIds": [
        "statvfs",
        "hesela-capacity"
      ]
    }
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-01",
  "related": [
    "filesystem-quota",
    "inode",
    "file-preallocation",
    "thin-provisioning",
    "fat-cluster-chain",
    "ext4",
    "allocation-unit",
    "filesystem-block"
  ],
  "provenance": [
    "API and implementation source review; no quota-exhaustion experiment. [hesela-capacity]"
  ],
  "citations": [
    {
      "id": "statvfs",
      "title": "Linux man-pages: statvfs(3), block units and availability counters",
      "url": "https://man7.org/linux/man-pages/man3/statvfs.3.html",
      "accessed": "2026-10-21"
    },
    {
      "id": "xfs-statfs",
      "title": "Linux v6.8: XFS statfs project-scope selection",
      "url": "https://github.com/torvalds/linux/blob/v6.8/fs/xfs/xfs_super.c#L770-L839",
      "accessed": "2026-10-21"
    },
    {
      "id": "xfs-quota-counters",
      "title": "Linux v6.8: XFS quota-adjusted filesystem counters",
      "url": "https://github.com/torvalds/linux/blob/v6.8/fs/xfs/xfs_qm_bhv.c#L18-L62",
      "accessed": "2026-10-21"
    },
    {
      "id": "hesela-capacity",
      "title": "Hesela: filesystem quotas and capacity headroom",
      "url": "https://hesela.com/analyses/sparse-files-preallocation-thin-capacity/#quota-headroom",
      "accessed": "2026-10-21"
    },
    {
      "id": "vfat-usefree",
      "title": "Linux v6.12 VFAT documentation: usefree",
      "url": "https://www.kernel.org/doc/html/v6.12/filesystems/vfat.html",
      "accessed": "2026-10-25"
    },
    {
      "id": "fatfs-evidence",
      "title": "Hesela: FatFs R0.16 FSInfo experiment, original captures and reproduction instructions",
      "url": "https://hesela.dev/research/fat32-fsinfo/README.md",
      "accessed": "2026-10-25"
    },
    {
      "id": "ext4-reserve-statfs",
      "title": "Linux v6.12: ext4_statfs reserve accounting and project-quota adjustment",
      "url": "https://github.com/torvalds/linux/blob/v6.12/fs/ext4/super.c#L6754-L6830",
      "accessed": "2026-11-01"
    },
    {
      "id": "ext4-reserve-allocation",
      "title": "Linux v6.12: ext4_has_free_clusters credential and internal-reserve checks",
      "url": "https://github.com/torvalds/linux/blob/v6.12/fs/ext4/balloc.c#L620-L666",
      "accessed": "2026-11-01"
    },
    {
      "id": "tune2fs-reserve",
      "title": "e2fsprogs tune2fs(8): reserved-block count, percentage, user and group",
      "url": "https://man7.org/linux/man-pages/man8/tune2fs.8.html",
      "accessed": "2026-11-01"
    }
  ]
}
