IOCTL-XFS-FSGEOMETRY(2)
π ioctl_xfs_fsgeometry(2) β the XFS filesystem vibe report π
okay bestie, welcome to the ioctl_xfs_fsgeometry page from the System Calls Manual π
this is the one where you ask the kernel "so... what's actually going on with this XFS filesystem of mine?" and it spills ALL the tea.
β¨ NAME β¨
ioctl_xfs_fsgeometry β report XFS filesystem layout and features π¦
πΈ SYNOPSIS πΈ
#include <xfs/xfs_fs.h>
int ioctl(int fd, XFS_IOC_FSGEOMETRY, struct xfs_fsop_geom *arg);
int ioctl(int fd, XFS_IOC_FSGEOMETRY_V4, struct xfs_fsop_geom_v4 *arg);
int ioctl(int fd, XFS_IOC_FSGEOMETRY_V1, struct xfs_fsop_geom_v1 *arg);
π DESCRIPTION π
So like. You want the details of an XFS filesystem β the layout, the features, all the other descriptive little items. The kernel hands it over in a struct that looks exactly like this, no cap:
struct xfs_fsop_geom {
__u32 blocksize;
__u32 rtextsize;
__u32 agblocks;
__u32 agcount;
__u32 logblocks;
__u32 sectsize;
__u32 inodesize;
__u32 imaxpct;
__u64 datablocks;
__u64 rtblocks;
__u64 rtextents;
__u64 logstart;
unsigned char uuid[16];
__u32 sunit;
__u32 swidth;
__s32 version;
__u32 flags;
__u32 logsectsize;
__u32 rtsectsize;
__u32 dirblocksize;
/* struct xfs_fsop_geom_v1 stops here. */
__u32 logsunit;
/* struct xfs_fsop_geom_v4 stops here. */
__u32 sick;
__u32 checked;
__u64 rgextents;
__u64 rtstart;
__u64 rtreserved;
__u64 reserved[14];
};
okay now let's go field by field, i gotchu π«Ά
blocksizeβ the size of a fundamental filesystem block, in bytes.rtextsizeβ the size of an extent on the realtime volume, in bytes.agblocksβ the size of an allocation group, measured in filesystem blocks.agcountβ how many allocation groups the filesystem has.logblocksβ the size of the log, in units of filesystem blocks.sectsizeβ the smallest amount of data that can be written to the data device atomically, in bytes.inodesizeβ the size of an inode record, in bytes.imaxpctβ the max percentage of the filesystem that can be handed over to inode record blocks.datablocksβ the size of the data device, in units of filesystem blocks.rtblocksβ the size of the realtime device, in units of filesystem blocks.rtextentsβ the number of extents that can be allocated on the realtime device.logstartβ the start of the log, in units of filesystem blocks. π« heads up: if the filesystem has an external log, this will be0.uuidβ the universal unique identifier of the filesystem β¨ (yes, the whole personality).sunitβ what the filesystem has been told is the size of a RAID stripe unit on the underlying data device, in filesystem blocks.swidthβ what the filesystem has been told is the width of a RAID stripe on the underlying data device, in units of RAID stripe units.versionβ the version of this structure. This value will beXFS_FSOP_GEOM_VERSION.flagsβ tells you which features are enabled on the filesystem. Go look at the FILESYSTEM FEATURE FLAGS section below for the whole rundown on each feature. πlogsectsizeβ the smallest amount of data that can be written to the log device atomically, in bytes.rtsectsizeβ the smallest amount of data that can be written to the realtime device atomically, in bytes.dirblocksizeβ the size of directory blocks, in bytes.logsunitβ what the filesystem has been told is the size of a RAID stripe unit on the underlying log device, in filesystem blocks. lowkey important: this field is meaningful only if the flagXFS_FSOP_GEOM_FLAGS_LOGV2is set.sickandcheckedβ these two are giving health check π they indicate the relative health of various whole-filesystem metadata. see the XFS METADATA HEALTH REPORTING section for more details.rgextentsβ Is the number of RT extents in each rtgroup.rtstartβ Start of the internal RT device in fsblocks.0if an external RT device is used. This field is meaningful only if the flagXFS_FSOP_GEOM_FLAGS_ZONEDis set.rtreservedβ The amount of space in the realtime section that is reserved for internal use by garbage collection and reorganization algorithms in fsblocks. This field is meaningful only if the flagXFS_FSOP_GEOM_FLAGS_ZONEDis set.reservedβ is set to zero. that's it. that's the whole job. zero.
π FILESYSTEM FEATURE FLAGS π
All the filesystem features get reported to userspace as a combination of the following flags. collect them like stickers π
XFS_FSOP_GEOM_FLAGS_ATTRβ Extended attributes are present.XFS_FSOP_GEOM_FLAGS_NLINKβ Files on this filesystem support up to 2^32 hard links. If this flag is not set, files on this filesystem support only up to 2^16 hard links.XFS_FSOP_GEOM_FLAGS_QUOTAβ Quotas are enabled.XFS_FSOP_GEOM_FLAGS_IALIGNβ Inodes are aligned for better performance.XFS_FSOP_GEOM_FLAGS_DALIGNβ Filesystem tries to align data block allocations to RAID stripe units for better performance.XFS_FSOP_GEOM_FLAGS_SHAREDβ Unused.XFS_FSOP_GEOM_FLAGS_EXTFLGβ Filesystem supports unwritten extents.XFS_FSOP_GEOM_FLAGS_DIRV2β Directories are in version 2 format and maintain free space data for better performance. Version 1 format directories are no longer supported. (rip v1, you had a good run π)XFS_FSOP_GEOM_FLAGS_LOGV2β Log uses the V2 format.XFS_FSOP_GEOM_FLAGS_SECTORβ The log device has a sector size larger than 512 bytes.XFS_FSOP_GEOM_FLAGS_ATTR2β Filesystem contains V2 extended attributes.XFS_FSOP_GEOM_FLAGS_PROJID32β Project IDs can be as large as 2^32. If this flag is not set, the filesystem supports only 2^16 project IDs.XFS_FSOP_GEOM_FLAGS_DIRV2CIβ Case-insensitive lookups are supported on directories.XFS_FSOP_GEOM_FLAGS_LAZYSBβ On-disk superblock counters are updated only at unmount time.XFS_FSOP_GEOM_FLAGS_V5SBβ Metadata blocks are self describing and contain checksums.XFS_FSOP_GEOM_FLAGS_FTYPEβ Directories contain inode types in directory entries.XFS_FSOP_GEOM_FLAGS_FINOBTβ Filesystem maintains an index of free inodes.XFS_FSOP_GEOM_FLAGS_SPINODESβ Filesystem may allocate discontiguous inode chunks when free space is fragmented.XFS_FSOP_GEOM_FLAGS_RMAPBTβ Filesystem stores reverse mappings of blocks to owners.XFS_FSOP_GEOM_FLAGS_REFLINKβ Filesystem supports sharing blocks between files.XFS_FSOP_GEOM_FLAGS_EXCHANGE_RANGEβ Filesystem can exchange file contents atomically viaXFS_IOC_EXCHANGE_RANGE.XFS_FSOP_GEOM_FLAGS_METADIRβ Filesystem contains a metadata directory tree.XFS_FSOP_GEOM_FLAGS_ZONEDβ Filesystem uses the zoned allocator for the RT device.
π©Ί XFS METADATA HEALTH REPORTING π©Ί
The online filesystem checking utility scans metadata and records what it finds in the kernel incore state. So how does userspace read the incore health status of the filesystem? bestie, it's this scheme right here:
- If a given sick flag is set in
sick, then that piece of metadata has been observed to be damaged. The same bit should be set inchecked. - If a given sick flag is set in
checkedbut is not set insick, then that piece of metadata has been checked and is not faulty. - If a given sick flag is not set in
checked, then no conclusion can be made.
and these are the flags that apply to those fields π§
XFS_FSOP_GEOM_SICK_COUNTERSβ Inode and space summary counters.XFS_FSOP_GEOM_SICK_UQUOTAβ User quota information.XFS_FSOP_GEOM_SICK_GQUOTAβ Group quota information.XFS_FSOP_GEOM_SICK_PQUOTAβ Project quota information.XFS_FSOP_GEOM_SICK_RT_BITMAPβ Free space bitmap for the realtime device.XFS_FSOP_GEOM_SICK_RT_SUMMARYβ Free space summary for the realtime device.XFS_FSOP_GEOM_SICK_QUOTACHECKβ Quota resource usage counters.
β RETURN VALUE β
On error, -1 is returned, and errno is set to indicate the error. that's the whole deal π
π₯ ERRORS π₯
Error codes can be one of, but are not limited to, the following:
EFAULTβ The kernel was not able to copy into the userspace buffer.EFSBADCRCβ Metadata checksum validation failed while performing the query.EFSCORRUPTEDβ Metadata corruption was encountered while performing the query.EIOβ An I/O error was encountered while performing the query.
π CONFORMING TO π
This API is specific to XFS filesystem on the Linux kernel. it's giving β¨exclusiveβ¨
π¦ SEE ALSO π¦
and that's the page, bestie, you ate it π ngl this one was written by XFS, version dated 2019-06-17 β iconic behavior from 2019 fr fr, and it's still the moment. periodt. πβ¨π
π¦ where this page comes from
- arch rolling: xfsprogs 7.2.1-1 Β· GPL-2.0-only AND LGPL-2.1-only
- nixpkgs unstable: xfsprogs 7.2.1
- π 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