
Self-explanatory placeholder (typically) matches the keyword catch phrase statement. Table of Contents 🔈Introduction Migrating from Ext4 to Btrfs has become a common objective for Linux
A practical guide to performance tuning XFS file systems on Enterprise Linux, covering mount options, hardware alignment, workload-specific tuning, and monitoring best practices.
XFS is the default file system on many Enterprise Linux distributions for a reason: it scales, performs reliably under heavy workloads, and offers mature tooling. Yet out-of-the-box defaults are rarely optimal for every environment. Database servers, virtualization hosts, backup repositories, and analytics platforms all stress storage differently.
This guide explains how to tune XFS file systems on Enterprise Linux (such as RHEL, AlmaLinux, Rocky Linux, and Oracle Linux) for real-world performance. It is written for system administrators, SREs, and platform engineers who want practical, measurable improvements without sacrificing stability.
XFS was designed for large-scale systems with parallel I/O, but performance depends on:
|
|
|
|
|
Poor tuning can result in:
|
|
|
|
Well-tuned XFS, by contrast, delivers consistent performance at scale with minimal maintenance.
Before tuning, it helps to understand what makes XFS different.
🔑 Key XFS Design Elements |
| Component | Description |
|---|---|
| Allocation Groups (AGs) | Enable parallel metadata and data allocation |
| Extents | Reduce fragmentation and metadata overhead |
| Delayed Allocation | Improves write aggregation |
| Journaling (Metadata) | Ensures fast crash recovery |
| B+ Trees | Efficient metadata indexing |
XFS favors concurrency and large I/O, making it ideal for enterprise workloads—but only if configured correctly.
File system tuning cannot compensate for poor storage design.
🔥 Best Practices |
|
|
|
|
|
Before tuning XFS, verify alignment:
lsblk -o NAME,ALIGNMENT
Sample output:
NAME ALIGNMENT
sda 0
├─sda1 0
├─sda2 0
├─sda3 0
├─sda4 0
├─sda5 0
├─sda6 0
├─sda7 0
├─sda8 0
├─sda9 0
├─sda10 0
├─sda11 0
├─sda12 0
├─sda13 0
└─sda18 0
├─rhel09_desktop_vol01-var 0
├─rhel09_desktop_vol01-root 0
├─rhel09_desktop_vol01-home 0
└─rhel09_desktop_vol01-swap 0
sdb 0
sdc 0
sdd 0
└─sdd1 0
sr0 0
Misalignment can silently degrade performance by 30–50%.
XFS performance begins at mkfs.xfs.
🔑 Key |
mkfs.xfs -f -m reflink=1,crc=1 -d su=256k,sw=4 /dev/mapper/data_lv
🟡 Important Parameters Explained |
| Option | Purpose | When to Use |
|---|---|---|
su / sw | Stripe unit / width | RAID arrays |
reflink=1 | Enables copy-on-write | VM images, snapshots |
crc=1 | Metadata checksums | Always recommended |
inode64 | Allows large inode space | Large filesystems |
👉 Tip: Once created, many parameters cannot be changed. Plan carefully. |
Mount options are the most common tuning lever—and the most misused.
🟢 Common Performance-Oriented Mount Options |
UUID=xxxx /data xfs defaults,noatime,nodiratime,logbufs=8,logbsize=256k 0 0
🟢 Recommended Options by Use Case |
| Option | Benefit |
|---|---|
noatime | Eliminates access-time writes |
nodiratime | Reduces directory metadata writes |
logbufs=8 | Improves metadata throughput |
logbsize=256k | Larger log buffers for heavy metadata workloads |
inode64 | Prevents inode allocation bottlenecks |
👉 Tip: Avoid excessive options. More is not always better. |
Metadata-heavy workloads (email servers, package repos, CI systems) can stress XFS.
🟡 Increase Log Performance |
XFS uses a metadata journal (log). Increasing its efficiency improves operations like file creation and deletion.
mount -o remount,logbufs=8,logbsize=256k /data
🟡 Separate Log Device (Advanced) |
For extreme metadata workloads, placing the log on a fast device (NVMe) can help:
mkfs.xfs -l logdev=/dev/nvme0n1 /dev/data
This is most beneficial on spinning disks.
Databases generate synchronous writes and random I/O.
🟡 Recommended Mount Options |
noatime,nodiratime,attr2,inode64
🔑 Key Considerations |
| Area | Recommendation |
|---|---|
| Barriers | Keep enabled (data safety) |
| Reflink | Disable for DB data volumes |
| Direct I/O | Let DB manage buffering |
| Log Size | Larger log buffers improve throughput |
👉 Tip: Avoid disabling write barriers unless your storage guarantees power-loss protection. |
VM images and containers stress XFS differently.
🟢 For VM Storage |
|
|
|
mkfs.xfs -m reflink=1 -d agcount=32 /dev/vg/vmdata
🟢 Container Hosts |
XFS is the only supported filesystem for some container runtimes with overlay storage.
Ensure:
|
|
|
File system tuning works best with proper block-layer configuration.
🟢 Check Scheduler |
cat /sys/block/nvme0n1/queue/scheduler
🟢 Recommendations |
| Storage Type | Scheduler |
|---|---|
| NVMe | none |
| SSD | mq-deadline |
| HDD | deadline |
Set temporarily:
echo mq-deadline > /sys/block/sda/queue/scheduler
Persist via udev rules for production.
XFS relies on the Linux page cache.
🔑 Key Kernel Parameters |
| Parameter | Purpose |
|---|---|
vm.dirty_ratio | Max dirty pages |
vm.dirty_background_ratio | Background flush threshold |
vm.swappiness | Swap behavior |
Example tuning for write-heavy systems:
sysctl -w vm.dirty_ratio=20
sysctl -w vm.dirty_background_ratio=10
Avoid extreme values; stability matters more than peak benchmarks.
You cannot tune what you cannot measure.
🛠️ Useful Tools |
| Tool | Use |
|---|---|
iostat | Disk utilization |
xfs_info | Filesystem layout |
xfs_growfs | Online resizing |
fio | Synthetic I/O testing |
perf | CPU and I/O profiling |
Example fio test:
fio --name=randwrite --ioengine=libaio --iodepth=32 \
--rw=randwrite --bs=4k --numjobs=4 --size=10G --time_based
Benchmark before and after tuning to validate changes.
XFS resists fragmentation better than many file systems, but it still happens.
🏆 Best Practices |
|
|
|
xfs_db -r -c frag -c quit /dev/data
💡NOTE: XFS does not support online defragmentation in the traditional sense, so prevention is key. |
|
|
|
|
|
Stability and predictability matter more than chasing marginal gains.
| Area | Recommendation |
|---|---|
| Filesystem Creation | Align with hardware |
| Mount Options | Minimal, workload-specific |
| Monitoring | Continuous, not reactive |
| Backups | Test restore performance |
| Documentation | Record tuning decisions |
XFS is a proven, enterprise-grade file system that rewards thoughtful tuning. By aligning filesystem design, mount options, kernel behavior, and hardware capabilities, you can achieve predictable, high-performance storage without sacrificing reliability.
Start with small, measurable changes. Benchmark carefully. Document everything. Over time, these incremental improvements add up to a significantly more resilient and performant platform.
Did you find this article helpful? Your feedback is invaluable to us! Feel free to share this post with those who may benefit, and let us know your thoughts in the comments section below.

Self-explanatory placeholder (typically) matches the keyword catch phrase statement. Table of Contents 🔈Introduction Migrating from Ext4 to Btrfs has become a common objective for Linux

Learn how to benchmark and optimize disk performance on Linux using fio. This comprehensive guide covers installation, test scenarios, interpreting results, and tuning tips to

Learn how implementing and managing File Access Policies (FAP) in Linux enhances security. This guide covers permissions, ACLs, SELinux, and audit logs with commands and
