XFS: The Top Choice for Big Data on CentOS Stream 9
Rapidly expanding data is always a challenge for any SysAdmin. Previously, I often prioritized ext4 due to familiarity. However, when faced with a log system reaching 20TB for an e-commerce platform, ext4 started to struggle. The file system check (fsck) time would last for hours, making downtime a disaster. That was when I switched to XFS and realized its true power.
On CentOS Stream 9, XFS is the default file system, designed to handle files up to 8 Exabytes. If you are operating large databases or media servers, mastering the xfs_progs toolkit is mandatory. It not only helps optimize performance but also serves as a lifesaver when the system encounters I/O issues.
Why XFS Excels in Production Environments?
XFS utilizes a 64-bit structure with impressive scalability. The key difference lies in the Allocation Groups (AG) mechanism. XFS divides the disk into independent groups to handle processes in parallel. As a result, the system minimizes bottlenecks when hundreds of processes are writing data simultaneously.
Practical advantages you should care about:
- Journaling: Extremely fast system state recovery after unexpected power loss.
- Online Resizing: Expand capacity while the disk is active. You don’t need to stop services, ensuring 24/7 uptime.
- Speed: XFS handles large files and directories containing millions of files much more efficiently than ext4.
One note: XFS does not support shrinking. Plan your partitions carefully from the start to avoid future complications.
Hands-on Administration with xfs_progs
Most CentOS Stream 9 installations already include this tool. If you are using the Minimal version, install it using the following command:
sudo dnf install xfs_progs -y
1. Inspecting Detailed Parameters with xfs_info
Always check the disk structure before making any changes. This command displays block size, the number of AGs, and metadata parameters.
# Check via device or mount point
sudo xfs_info /dev/sda1
sudo xfs_info /mnt/data
Typically, bsize (block size) is 4096 bytes. For 4K video storage systems or massive databases, fine-tuning a larger block size during formatting can significantly boost read/write speeds.
2. “Hot” Disk Expansion with xfs_growfs
A very familiar scenario: Your server hard drive is in the red, and you’ve just added 500GB from a SAN or expanded the disk on VMware. With XFS, it only takes a few seconds for the system to recognize the new capacity without needing a reboot.
After expanding the physical partition or LVM, run the following command:
# Expand the file system at mount point /data
sudo xfs_growfs /data
Pro tip: Always run lvextend (if using LVM) first. Then use xfs_growfs to “grow” the file system. If done in reverse or if the LVM step is forgotten, the command will have no effect.
3. Recovering Data with xfs_repair
When a server loses power and cannot mount the data drive, xfs_repair is the lifesaver. Compared to fsck, xfs_repair processes Terabyte partitions significantly faster thanks to its multi-threaded architecture.
Iron Rule: Absolutely do not run this command while the partition is mounted. This can cause permanent data destruction.
# Step 1: Unmount the faulty partition
sudo umount /dev/sdb1
# Step 2: Proceed with the repair
sudo xfs_repair /dev/sdb1
If the error is in the root (/) partition, you will need to boot from a rescue USB/ISO to perform this operation.
4. Ensuring Snapshot Safety with xfs_freeze
When you need to create a virtual machine snapshot or a storage-level backup, data integrity is the top priority. xfs_freeze suspends all I/O activity and flushes data from RAM to the hard disk immediately.
# Freeze to start the snapshot
sudo xfs_freeze -f /mnt/data
# After the snapshot is finished, unfreeze to resume system operation
sudo xfs_freeze -u /mnt/data
Optimal Configuration for High-Performance Environments
To make XFS run at its smoothest, I often adjust parameters in /etc/fstab. The following two options are extremely useful for systems running on SSDs:
- noatime: Disables recording file access times. This significantly reduces unnecessary write I/O operations.
- logbsize=256k: Increases the in-memory log buffer. A value of 256k helps speed up metadata processing when creating or deleting thousands of small files simultaneously.
Sample configuration in /etc/fstab:
/dev/mapper/data-lv /data xfs defaults,noatime,logbsize=256k 0 0
Conclusion
Understanding XFS allows you to confidently manage large-scale storage systems. Although XFS is very robust, never forget the golden rule: Always have a backup plan. You can use xfsdump to periodically back up important changes.
I hope these hands-on experiences help you master CentOS Stream 9 more effectively. If you encounter any strange error codes while using xfs_repair, feel free to leave a comment below so I can assist you!

