XFS
| Filesystems |
|---|
| Virtual Filesystems |
| Disk Filesystems |
| CD/DVD Filesystems |
| Network Filesystems |
| Flash Filesystems |
XFS is a high-performance journaling file system created to replace EFS on IRIX it has since been ported to Linux and received additional development there.
Basic Specifications
XFS is a 64-bit file system. It supports a maximum file system size of 8 EiB, though many operating systems have implementations that limit this. IRIX is known to support up to 8 TiB volumes.[1]
| Directory Structure | B+ Trees |
| File Contents | B+ Trees |
| Max Volume Size | 8 Terabytes (IRIX), 8 Exabytes (GNU/Linux) |
| Max File Size | 4 Terabytes |
| Max Filename Length | 255 Bytes |
On-disk Structure
On disk Header Info[2]
struct xfs_ondisk_hdr {
__be32 magic; /* magic number */
__be32 crc; /* CRC, not logged */
uuid_t uuid; /* filesystem identifier */
__be64 owner; /* parent object */
__be64 blkno; /* location on disk */
__be64 lsn; /* last modification in log, not logged */
};
magic: This is the unique ID telling the OS that the filesystem is an XFS filesystem. The magic humber for XFS is58 46 53 42which in ASCII is "XFSB" standing for XFS Block.crc: This is a checksum for the header to ensure data integrity. It’s not logged, meaning it doesn’t get saved in the XFS transaction log (journal).uuid: This is the filesystem identifier. It’s a unique 128-bit identifier (UUID) for the XFS filesystem, used to distinguish between different XFS filesystems.owner: This represents the parent object of the filesystem (could be a device or logical unit), and it’s typically used in a system where objects can be nested. It helps identify who owns the filesystem.blkno: This is the block number or the location of the XFS filesystem's header on the disk. It specifies where this specific structure is physically located.
lsn: The log sequence number (LSN) represents the last modification timestamp in the log. It indicates when the filesystem was last modified but is not logged itself, meaning it’s not part of the transaction log.
Allocation Group B+ Tree Blocks
struct xfs_btree_sblock {
__be32 bb_magic;
__be16 bb_level;
__be16 bb_numrecs;
__be32 bb_leftsib;
__be32 bb_rightsib;
/* version 5 extras start here */
__be64 bb_blkno;
__be64 bb_lsn;
uuid_t bb_uuid;
__be32 bb_owner;
__le32 bb_crc;
};
Short blocks use 32-bit pointers for the filesystem blocks.[3]
bb_magic: Specifies the magic number for the per-AG B+tree block.bb_level:The level of the tree in which this block is found. If this value is 0, this is a leaf block and contains records; otherwise, it is a node block and contains keys and pointers. Level values increase towards the root.bb_numrecs:Number of records in this block.bb_leftsibAG block number of the left sibling of this B+tree node.bb_rightsibAG block number of the right sibling of this B+tree node.bb_blknoFS block number of this B+tree block.bb_lsnLog sequence number of the last write to this block.bb_uuidThe UUID of this block, which must match either sb_uuid or sb_meta_uuid depending on which features are set.bb_ownerThe AG number that this B+tree block ought to be in.bb_crcChecksum of the B+tree block.
xfsprogs
xfsprogs is the open source set of xfs utilities used on GNU/Linux to perform filesystem tasks. It includes:
- mkfs.xfs - used to make new xfs filesystems
- fsck.xfs - used to ensure filesystem consistency
- xfs_freeze - suspends access to filesystem to allow dumping or growing the filesystem.
- xfs_info - prints geometry info about xfs.
- xfs_repair - repairs corrupted xfs volumes
- xfs_scrub - used to rebuild filesystem metadata.
Other programs are included as well. These are the notable ones.[4]
OS Support
Linux kernel has supported XFS since around 2001, in the 2.4.x branch.
IRIX began using XFS starting with major version 6.2. Special 5.3 version was offered with XFS as well.
Shrinking XFS Volumes
As of 2025 neither IRIX nor Linux kernel XFS supports shrinking. Per archive Linux Kernel Mailing List discussion[5] there are a few reasons:
- Filesystem has no way to mark allocation groups as unavailable (to prevent use during shrink operation)
- Inodes need to be removed from unavailable allocation groups.
- Somehow move data out of unavailable groups easily.
- xfsprogs lacks ability to move journal structures safely
Further Reading
- ↑ https://tech-pubs.net/wiki/index.php/XFS
- ↑ XFS Algorithms & Data Structures. 2006. 3rd ed., Silicon Graphics Corparation, Apr. 2025, pp. 7–8, ftp.ntu.edu.tw/linux/utils/fs/xfs/docs/xfs_filesystem_structure.pdf. Accessed 31 Dec. 2025. XFS On Disk Header.
- ↑ XFS Algorithms & Data Structures. 2006. 3rd ed., Silicon Graphics Corparation, Apr. 2025, pp. 34-35, ftp.ntu.edu.tw/linux/utils/fs/xfs/docs/xfs_filesystem_structure.pdf. Accessed 31 Dec. 2025. XFS On Disk Header.
- ↑ https://archive.kernel.org/oldwiki/xfs.wiki.kernel.org/
- ↑ https://web.archive.org/web/20230910042608/https://marc.info/?l=linux-xfs&m=118091640624488&