XFS

On this page 7

XFS is a 64-bit journaling filesystem designed for high throughput, large files and very large volumes, which organizes storage into independent allocation groups so that many threads can read and write in parallel. It records metadata changes in a journal before applying them, so the filesystem can recover to a consistent state quickly after a crash.

In the Linux filesystem topic, XFS is one of the three mainstream choices alongside ext4 and Btrfs. Silicon Graphics created it in 1993 for the IRIX operating system and ported it to Linux around 2001. It is the default filesystem of Red Hat Enterprise Linux since version 7 and its derivatives, and it is widely used for databases, media storage and large file servers.

How XFS organizes data on disk

XFS divides a volume into allocation groups, each managing its own free space and inodes with B+ trees. Because each group has independent locks, concurrent writers in different groups do not block each other, which is the root of the strong parallel performance of XFS on multi-core servers and multi-disk arrays.

File data is tracked with extents, contiguous ranges described by a start block and length, instead of lists of individual blocks. Delayed allocation postpones choosing disk locations until data is flushed from memory, which lets XFS place large writes contiguously and reduces fragmentation.

The table summarizes the main on-disk structures.

StructureFunctionPractical effect
Allocation groupIndependent region with its own metadataParallel allocation and scalability
Extent mapDescribes file data as contiguous rangesEfficient handling of large files
Dynamic inodesInodes created on demandNo fixed inode limit set at format time
Metadata journalLogs metadata changes before commitFast crash recovery
Reverse mapping B+ treeMaps blocks back to their ownersOnline repair and reflink support
Core XFS structures

Key limits and capabilities

XFS is built for scale. Its theoretical limits far exceed any current single volume, and its feature set targets data-heavy workloads rather than desktop snapshots or checksums of user data.

PropertyValue or supportNote
Maximum file system size8 exbibytes on 64-bit systemsPractically limited by hardware
Maximum file size8 exbibytesSuits very large media and database files
Online growthYes, with xfs_growfsVolume can be enlarged while mounted
ShrinkingNot supported in generalPlan sizes or use thin provisioning
Metadata checksumsYes, on by default in modern versionsDetects metadata corruption
Reflink copiesYes, on by default in recent toolsInstant copy-on-write file clones
XFS limits and features

XFS checksums its metadata but not file contents, so silent corruption of user data is not detected by the filesystem itself; applications, RAID scrubbing or a checksumming filesystem must provide that protection.

XFS compared with ext4 and Btrfs

The three common Linux filesystems target different priorities. The comparison below reflects typical behavior; actual results depend heavily on workload, kernel version and hardware.

AspectXFSext4Btrfs
Design focusParallel throughput, large filesGeneral-purpose reliabilityFeatures and data integrity
Data checksumsNoNoYes
SnapshotsNo native snapshotsNo native snapshotsYes, subvolume based
Shrink volumeNoYes, offlineYes, online
Repair toolxfs_repaire2fsckbtrfs check and scrub
Typical defaultRHEL, Rocky Linux, AlmaLinuxDebian, UbuntuFedora Workstation, openSUSE
XFS, ext4 and Btrfs at a glance

As a rule of thumb, XFS suits large volumes with concurrent I/O, ext4 suits general-purpose systems and small volumes, and Btrfs suits systems that benefit from snapshots and checksums.

Creating, tuning and maintaining XFS

A filesystem is created with mkfs.xfs, which detects RAID stripe geometry from the block layer in most cases; on hardware RAID that hides geometry, setting the stripe unit and width manually avoids misaligned writes. Default options are well chosen for most systems, and tuning beyond alignment rarely pays off.

  • Use xfs_info to inspect geometry and enabled features of a mounted filesystem.
  • Grow a filesystem after enlarging the volume with xfs_growfs and the mount point, not the device.
  • Run xfs_repair only on an unmounted filesystem; after a crash, mounting first lets the journal replay.
  • Back up with xfsdump or file-level tools; snapshots require LVM or the storage layer.
  • Enable periodic fstrim on SSDs to return unused blocks to the device.

Limitations and common mistakes

Most XFS problems in practice arise from planning errors, not from defects in the filesystem.

MistakeConsequenceRemedy
Oversizing a volume expecting to shrink laterSpace cannot be reclaimedStart smaller and grow online
Running xfs_repair -L hastilyDiscards the journal and recent metadataMount to replay the log first
Old kernels with new format featuresFilesystem refuses to mountMatch mkfs.xfs options to target kernels
Expecting data checksumsSilent data corruption goes unnoticedUse scrubbing storage or Btrfs where needed
XFS pitfalls and remedies

A non-technical view

XFS is a way of organizing files on a disk so a Linux computer can store and find them quickly. It is especially good at handling very large files and many tasks at once, such as video archives or busy databases.

Picture a huge warehouse divided into many sections, each with its own team and inventory book. Several teams can store and fetch goods at the same time without waiting for one central clerk. That is how XFS stays fast on large, busy systems.

A concrete example

A video post-production studio stores raw 8K footage on a 200 TB RAID array attached to a Linux server running Rocky Linux. Editors on a dozen workstations read and write large files at the same time over the network. The administrator formats the array with XFS, letting mkfs.xfs align to the RAID stripe, and mounts it as the shared project volume.

Because writes from different editors land in different allocation groups, the array sustains high parallel throughput without lock contention. When a new project requires more capacity, the administrator extends the logical volume and runs xfs_growfs during working hours, with no downtime. Reflink copies let assistants duplicate multi-gigabyte clips for experiments instantly, without consuming additional space until the copies are changed.