
Getty Images/iStockphoto
XFS vs. ext4: Which Linux file system to maximize storage?
Storage devices require a file system to organize data. Make the best choice -- XFS or ext4 -- for your Linux server's anticipated data storage workload.
Linux server admins must think carefully about which file system to choose -- XFS or ext4 -- based on each device's role and storage requirements. Desktop deployment and support personnel may find a different file system suits their systems better than one designed for high-performance servers.
With storage implications top of mind, compare XFS vs. ext4 file systems on Linux devices by examining flexibility, data protection, performance, capacity and security.
Distribution support
Most Linux distributions have a preferred or default file system, though you can modify that choice if necessary. Debian-based distributions typically use ext4, while Red Hat Enterprise Linux (RHEL) and Rocky Linux utilize XFS.
View the file systems in use by your system's storage devices by running one of the following commands:
- df -T.
- lsblk -f.
- blkid /dev/sda1 -- substitute your own device path.
The df -T command displays storage device information, including the file system. Note that /dev/sda1 uses XFS in Figure 1.

The lsblk -f command provides a more structured look at the storage devices, partitions and file systems. Note that /dev/sda1 and /dev/sda2 use XFS in Figure 2, while /dev/sdb1 and /dev/sdc1 both rely on ext4.

Gain a more focused perspective by specifying a particular volume or partition. Figure 3 shows the blkid /dev/sda1 results, including the file system type.

Use these common Linux storage analysis tools to determine the file systems in use on your servers.
Compare performance and capacity
Performance and capacity are interrelated, so they're evaluated together here.
The ext4 file system is designed for general use, making it a natural choice for developer workstations, user computers and home systems. While performance and capacity are certainly important to these users, they do not typically generate the immense files or workloads XFS is optimized to manage.
These types of workstations also typically do not have the massive storage capacity or parallel I/O operations XFS excels at managing. In the case of daily-use machines, ext4 normally performs better.
Ext4 file system attributes include the following:
- Maximum file size of 16 tebibytes (TiB), but RHEL 8 states 16 TB support.
- Maximum volume size of 64 zebibytes, but RHEL 8 states 50 TB support.
- Fixed inode allocation.
XFS file system attributes include the following:
- Maximum volume size of 1,024 TiB.
- Support for parallel operations.
- Dynamic inode allocation.
From a practical perspective, only a limited number of admins bump up against the size limitations of either file system.
XFS is also more resource-intensive than ext4, an important consideration for busy servers. Those busy servers may still benefit from XFS' greater ability to handle higher workloads.
Manage changing requirements
Storage requirements change over time as you adjust the server's role to the evolving business needs. XFS can grow with these requirements. Unfortunately, you cannot shrink it.
While most storage scenarios involve expanding capacity, the fact that you can't easily shrink an XFS file system limits its flexibility. The ext4 file system permits both growing and shrinking. This flexibility is crucial in environments that anticipate adjusting storage configurations.
XFS support came to the Linux kernel in 2001, so it's rare to find distributions that don't offer at least basic support. Many don't use it as the default, but allow custom installations or configurations later. Users can safely assume ext4 is supported by modern distributions, too. The main place you find support issues is with old distributions.
Manage and recover your file system
XFS contains a suite of management tools enabling administrators to back up, restore, resize, repair and even establish quotas on the file system. This integration of tools and their ease of use are attractive to many sys admins.
The XFS tool set includes the following:
- xfs_growfs. Grow the file system.
- xfs_admin. Manage parameters like label or universally unique identifier.
- xfs_copy. Copy the file system to another target.
- xfs_quota. Manage file system quotas.

While ext4 supports many of these features, admins implement them using external tools that may not be consistent or interrelated.
Use the following tools to manage ext4 file systems:
- e2fsck. Check and repair the file system.
- tune2fs. Manage parameters.
- resize2fs. Grow or shrink the file system.
- e2label. Change the file system label.
- quota. Manage file system quotas.

Many ext4 tools also support the older ext2 and ext3 file systems sometimes found on legacy systems.
Modern file systems support journaling, which improves their reliability and recovery time if there's a sudden power outage or system crash. Data changes are written to the journal before the file system, providing a record of recent modifications.
The file system scans the journal for recent events to recover from a crash instead of examining the entire disk. Both ext4 and XFS implement journaling, as do other common file systems, such as Windows NTFS.
Changing file systems
Neither file system provides a conversion method, though you may find third-party tools to help manage a migration from one file system to the other.
The standard approach to switching between XFS and ext4 is recreating the file system. This is a fancy way of saying you must back up the existing data on the current file system, create a new one on the storage disk and restore the data.
The steps look like this:
- Back up the existing data, and be sure to check its integrity.
- Unmount the volume using the umount command.
- Format the volume with the new ext4 or XFS file system.
- Restore the data from the backup, and test the system.
This process can be long, depending on the size of the volume. Remember that one of XFS' selling points is its support for huge file systems, and even ext4 supports quantities of data that take a long time to back up or restore. The speed of your storage infrastructure is also a factor here.
Be sure to verify the backup job before installing the new file system. You can use the mkfs.xfs or mkfs.ext4 commands to install the new one.

But wait, there's more to compare XFS vs. ext4
It's telling that Red Hat's own server platform defaults to XFS, while popular end-user distributions, like Ubuntu, rely on ext4 to manage storage. XFS excels in the higher-demand, higher-I/O environments where servers are likely to reside. Single-threaded general-use workstations may see a performance gain with ext4 vs. XFS.
Choosing a file system for your next deployment begins by understanding the device's role and anticipated workload. Be aware of the hardware involved, too. Make sure the storage devices do not bottleneck I/O operations before the file system even gets involved. Consider how flexible that storage may need to be because ext4 can be sized up and down, but XFS can only grow.
The choice to implement XFS is usually based on a specific need, such as high-performance computing. However, XFS' native support tools are powerful and convenient for administrators.
Look at your servers today, and decide whether the extra functionality and performance of XFS file systems will help maintain their speed and flexibility.
Damon Garn owns Cogspinner Coaction and provides freelance IT writing and editing services. He has written multiple CompTIA study guides, including the Linux+, Cloud Essentials+ and Server+ guides, and contributes extensively to Informa TechTarget Editorial, The New Stack and CompTIA Blogs.