IOCTL-XFS-AG-GEOMETRY(2)
π ioctl_xfs_ag_geometry β bestie, let's go snooping on your XFS allocation groups π
okay so this is a page from the System Calls Manual, section 2 β that's the IOCTL-XFS-AG-GEOMETRY(2) one, iykyk π¦
β¨ NAME β¨
ioctl_xfs_ag_geometry β query XFS allocation group geometry information
like. it literally just asks your filesystem "hey girl, tell me everything about this one allocation group" and the filesystem is like "say less π "
πΈ SYNOPSIS πΈ
#include <xfs/xfs_fs.h>
int ioctl(int fd, XFS_IOC_AG_GEOMETRY, struct xfs_ag_geometry *arg);
π DESCRIPTION π
This XFS ioctl retrieves the geometry information for a given allocation group. Not me pulling up receipts on your AG's whole life story π
The geometry information is conveyed in a structure of the following form:
struct xfs_ag_geometry {
uint32_t ag_number;
uint32_t ag_length;
uint32_t ag_freeblks;
uint32_t ag_icount;
uint32_t ag_ifree;
uint32_t ag_sick;
uint32_t ag_checked;
uint32_t ag_flags;
uint64_t ag_reserved[12];
};
okay now let's meet the fields one by one, they're all main characters π«Ά
ag_numberβ bestie you have to set this one yourself. Put in the index of the allocation group you wanna learn about. It's giving "you must choose your fighter" βag_lengthβ the length of the allocation group comes back here, measured in units of filesystem blocks.ag_freeblksβ how many free blocks are chillin' in this allocation group. Also in units of filesystem blocks.ag_icountβ the number of inode records allocated in this allocation group. comes back here β¨ag_ifreeβ the number of unused inode records (of the space allocated) in this allocation group. returned right here, no cap.ag_flagsβ you can set this field to change the operational behavior of the ioctl. butβ¦ currently no flags are defined, so this field must be zero. literally zero. don't try it πag_reservedβ all reserved fields will be set to zero on return. every single one. periodt.
π health check time: ag_sick and ag_checked π
The fields ag_sick and ag_checked indicate the relative health of various allocation group metadata. it's basically a vibe check for your metadata π©Ί
- If a given sick flag is set in
ag_sick, then that piece of metadata has been observed to be damaged. The same bit will be set inag_checked. she's hurt, fr fr π - If a given sick flag is set in
ag_checkedand is not set inag_sick, then that piece of metadata has been checked and is not faulty. she's fine, she ate π₯ - If a given sick flag is not set in
ag_checked, then no conclusion can be made. we simply do not know. shrug π
π the flags that apply to these fields π
XFS_AG_GEOM_SICK_SBβ Allocation group superblock.XFS_AG_GEOM_SICK_AGFβ Free space header.XFS_AG_GEOM_SICK_AGFLβ Free space reserve list.XFS_AG_GEOM_SICK_AGIβ Inode header.XFS_AG_GEOM_SICK_BNOBTorXFS_AG_GEOM_SICK_CNTBTβ Free space btrees.XFS_AG_GEOM_SICK_INOBTorXFS_AG_GEOM_SICK_FINOBTβ Inode btrees.XFS_AG_GEOM_SICK_RMAPBTβ Reverse mapping btree.XFS_AG_GEOM_SICK_REFCNTBTβ Reference count btree.
π« RETURN VALUE π«
On error, -1 is returned, and errno is set to indicate the error.
like yeah. it's -1. the classic "we have a problem" number π
π¨ ERRORS π¨
Error codes can be one of, but are not limited to, the following:
EFSBADCRCβ Metadata checksum validation failed while performing the query. the checksum said "not today" πEFSCORRUPTEDβ Metadata corruption was encountered while performing the query. uh oh. something's broken in there π©ΉEINVALβ The specified allocation group number is not valid for this filesystem. bestie that AG does not exist, stop it πEIOβ An I/O error was encountered while performing the query. the disk is being dramatic π«
lowkey note: these are the ones listed but the list is "not limited to" these, so other error codes can show up too. just so you're not blindsided π
π CONFORMING TO π
This API is specific to XFS filesystem on the Linux kernel. it's an XFS-exclusive, no gatekeeping, but also no portability πΈ
π¦ SEE ALSO π¦
okay that's the whole page, you're officially an XFS allocation group gossip now π
this was the XFS manual, dated 2019-08-30 β mwah, bye bestie, go query responsibly πβ¨π«Ά
π¦ 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