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
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.
bb_magic: Specifies the magic number for the per-allocation group 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_numrecsNumber of records in this block.bb_leftsiballocation group 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.
struct xfs_btree_lblock {
__be32 bb_magic;
__be16 bb_level;
__be16 bb_numrecs;
__be64 bb_leftsib;
__be64 bb_rightsib;
/* version 5 additions start here */
__be64 bb_blkno;
__be64 bb_lsn;
uuid_t bb_uuid;
__be64 bb_owner;
__le32 bb_crc;
__be32 bb_pad;
};
Long format B+trees are given 64-bit filesystem block numbers instead of 32-bit allocation group block numbers.
bb_magicSpecifies the magic number for the B+tree block.bb_levelThe 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.bb_numrecsNumber of records in this block.bb_leftsibFilesystem block number of the left sibling of this B+tree node.bb_rightsibFilesystem block number of the right sibling of this B+tree node.bb_blknoFilesystem 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 eithersb_uuidorsb_meta_uuiddepending on which features are set.bb_ownerThe allocation group number that this B+tree block is located in.bb_crcChecksum of the B+tree block.bb_padPads the structure to 64 bytes.
Block Headers
struct xfs_da3_blkinfo {
/* these values are shared with xfs_da_blkinfo */
__be32 forw;
__be32 back;
__be16 magic;
__be16 pad;
/* These values are unique to da3 blkinfo */
__be32 crc;
__be64 blkno;
__be64 lsn;
uuid_t uuid;
__be64 owner;
};
forwLogical block offset of the previous B+tree block at this level.backLogical block offset of the next B+tree block at this level.magicMagic number for this directory/attribute block.padPadding to maintain alignment.crcChecksum of the directory/attribute block.blknoBlock number of this directory/attribute block.lsnLog sequence number of the last write to this block.uuidThe UUID of this block, which must match either sb_uuid or sb_meta_uuid depending on which features are set.ownerThe inode number that this directory/attribute block belongs to.
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.[3]
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 support shrinking XFS volumes for several reasons:[4]
- 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
- XFS Algorithms and Data Structures - Contains useful specifications for the XFS file system, but is from 2006 and is likely outdated.
References
- ↑ 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.
- ↑ https://archive.kernel.org/oldwiki/xfs.wiki.kernel.org/
- ↑ https://web.archive.org/web/20230910042608/https://marc.info/?l=linux-xfs&m=118091640624488&