IOCTL-XFS-FSCOUNTS(2)
β¨ ioctl_xfs_fscounts β query XFS summary counter information β¨
okay bestie, so this is a page from the XFS corner of the System Calls Manual (section 2, iykyk) π and it's genuinely so useful, no cap.
πΈ NAME πΈ
ioctl_xfs_fscounts β the way to go ask your XFS filesystem for its summary counter tea βπ
π¦ SYNOPSIS π¦
#include <xfs/xfs_fs.h>
int ioctl(int fd, XFS_IOC_FSCOUNTS, struct xfs_fsop_counts *arg);
literally that's the whole vibe. one ioctl call, one struct pointer, and the filesystem spills its counters to you π«Ά
π DESCRIPTION π
So. You want the raw filesystem summary counters? This is that. π
And here's the part that matters, bestie: unlike statvfs(3), the values you get back here are the raw values. They do not reflect any alterations or limits set by project quotas. so if you're comparing the two, don't be shocked when the numbers don't match β one of them is wearing a quota filter and this one absolutely is not πβ¨
The counter info comes back in a structure shaped like this:
struct xfs_fsop_counts {
__u64 freedata;
__u64 freertx;
__u64 freeino;
__u64 allocino;
};
and the fields are, one by one, iconic in their own right π:
freedataβ the number of free filesystem blocks on the data device. πfreertxβ the number of free extents on the realtime device. βfreeinoβ the number of inode records that are not in use within the space that has been allocated for them. πallocinoβ the number of inode records for which space has been allocated. π
like, that's the whole struct. four __u64s. zero drama. main character energy fr fr.
π RETURN VALUE π
On error, -1 is returned, and errno is set to indicate the error. that's it, that's the rule. π
π₯ ERRORS π₯
Error codes can be one of, but are not limited to, the following β so don't come for me if your errno isn't on this list, bestie, the list is honest about being partial:
EFSBADCRCβ metadata checksum validation failed while performing the query. π checksum said no.EFSCORRUPTEDβ metadata corruption was encountered while performing the query. π¨ like, actually corrupted. not great.EINVALβ the specified allocation group number is not valid for this filesystem.EIOβ an I/O error was encountered while performing the query.
ngl if you're seeingEFSBADCRCorEFSCORRUPTEDyour filesystem is having a moment and you should probably pay attention to that. this is not a vibe check you want to fail. π«
π§ CONFORMING TO π§
This API is specific to XFS filesystem on the Linux kernel. no POSIX, no portability, no pretending. it's an XFS thing, for XFS, on Linux, periodt. π
π SEE ALSO π
and that's the page!! go forth and query your counters, you gorgeous nerd π¦π
β with love, from the XFS manual, dated 2019-06-17 πΈβ¨
π¦ where this page comes from
- alpine 3.22: xfsprogs-doc 6.14.0-r0 Β· LGPL-2.1-or-later
- alpine 3.23: xfsprogs-doc 6.17.0-r0 Β· LGPL-2.1-or-later
- alpine 3.24: xfsprogs-doc 7.0.1-r0 Β· LGPL-2.1-or-later
- arch rolling: xfsprogs 7.2.0-1
- arch rolling: xfsprogs 7.2.1-1 Β· GPL-2.0-only AND LGPL-2.1-only
- centos-stream 10: xfsprogs-devel 6.16.0-1.el10 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- centos-stream 9: xfsprogs-devel 6.4.0-9.el9 Β· GPL+ and LGPLv2+
- centos-stream 9: xfsprogs-devel 6.4.0-9.el9 Β· GPL+ and LGPLv2+
- debian bookworm: xfslibs-dev 6.1.0-1 Β· GPL-2.0-only
- debian trixie: xfslibs-dev 6.13.0-2+deb13u1 Β· GPL-2.0-only
- fedora 43: xfsprogs-devel 6.15.0-3.fc43 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 43: xfsprogs-devel 6.15.0-3.fc43 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 6.18.0-2.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 6.18.0-2.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 7.1.1-1.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- fedora 44: xfsprogs-devel 7.1.1-1.fc44 Β· GPL-1.0-or-later AND LGPL-2.1-or-later
- nixos 26.05: xfsprogs 6.19.0
- nixpkgs unstable: xfsprogs 7.2.1
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: xfsprogs 6.19.0-160000.3.1 Β· GPL-2.0-or-later
- ubuntu jammy: xfslibs-dev 5.13.0-1ubuntu2 Β· GPL-2.0-only
- ubuntu jammy: xfslibs-dev 5.13.0-1ubuntu2.1 Β· GPL-2.0-only
- ubuntu noble: xfslibs-dev 6.6.0-1ubuntu2 Β· GPL-2.0-only
- ubuntu noble: xfslibs-dev 6.6.0-1ubuntu2.1 Β· GPL-2.0-only
- ubuntu questing: xfslibs-dev 6.13.0-2ubuntu2
- ubuntu resolute: xfslibs-dev 6.18.0-3 Β· GPL-2.0-only
- ubuntu stonking: xfslibs-dev 6.19.0-1 Β· GPL-2.0-only
- π the page's license: GPL-2.0+
- Copyright (c) 2019, Oracle. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms