Exploring the features of the XFS file system on Linux

The XFS file system has been designed to deal with high file volumes and large files more efficiently. Find out how the file system manages these files, and when it might be appropriate to use this file system on your Linux servers instead of Ext3 or Ext4.

One of the most interesting of file system alternatives for enterprise Linux environments is XFS. In this tip we’ll explore the features and advantages the XFS file system offers that differ from ext3 and ext4.

The XFS file system was developed as a journaling file system that uses a B-tree balanced tree algorithm to allocate data as fast as possible. One of the major design goals was support for large files and large file systems. The maximum file size currently supported is 2 Exabytes, and the maximum file system size is 8 Exabytes.

XFS support
If you're considering using XFS, you first need to be aware that it's not available on all Linux distributions.
Red Hat does not offer XFS support by default, but offers it in the Scalable File System add-on product. SUSE Linux Enterprise Server has support for XFS and you can use it with other distributions such as Debian, Gentoo, Mandriva or Fedora.

How does XFS differ from ext3 or ext4?
Before you consider XFS, you should know how it is different. Many tasks work differently on XFS, including setting quota, repairing the file system, or even just copying a file. These differences occur because of the features XFS offers.

An important feature is the allocation group, which makes XFS a highly scalable file system that allows you to store large numbers of files, and very large files. Each allocation group manages its own inodes and free space and by creating allocation groups, you can make sure that several processes and threads can service the file system simultaneously, which can increase performance.

To address files efficiently, XFS works with extents -- a technique that has been adopted by Ext4. An extent is a group of blocks that can be addressed as one single entity. The benefit is that instead of addressing all blocks in use by a file individually, XFS addresses a limited amount of extents, which makes it much more efficient when addressing large files.

Delayed allocation is another helpful feature of XFS. When a file is first created, its contents are normally written to the buffer cache, and then it normally is flushed to disk. XFS waits to do that as long as possible because a new file often will have several modifications just after being created. By delaying the flushing of the file to disk as much as possible, the file system optimizes the way the file is written and allocates as many contiguous blocks or extents as possible, preventing file system fragmentation later.

XFS has some options for times when delayed allocation is not optimal. The direct I/O option guarantees that a file is not buffered in buffer cache, but written to disk immediately after it has been committed. XFS exclusively offers a guaranteed rate I/O, which guarantees that certain file systems have a minimum I/O-bandwidth. This feature makes XFS an excellent file system for streaming media.

XFS has some unique features that make it an excellent file system for environments that need to support either large amounts of files, or large files. But if you consider using XFS, you need to make a plan to implement it with the optimal performance settings for your Linux server environment.

Dig Deeper on Linux servers