Home > Articles > Operating Systems, Server

  • Print
  • + Share This

XFS: User-Tested, Mother Approved

The XFS filesystem is a high-performance journaling filesystem that has some potential advantages over the other journaling filesystems discussed in this article. Some of the primary reasons for considering XFS are as follows:

  • It has been in use for a long time, and is thus very robust.

  • It provides special support for high-performance, real-time files in a dedicated portion of the filesystem. (Not supported on Linux yet, but the code is there.)

  • It already provides support for enhanced access control for files and directories. Advanced access control features, such as access control lists to augment standard Linux security, are planned for other Linux filesystems, and already exist in advanced distributed filesystems for Linux such as AFS.

  • It uses sophisticated algorithms for file and directory lookup and disk space allocation.

Initially, the most interesting of these reasons for considering XFS is the fact that it has been in production use since 1994, running on every SGI workstation at thousands of customer sites. Because this gives it more history than even Linux's standard ext2 filesystem, adopting XFS for personal and even production use is a relatively safe bet as far as the base filesystem code goes. The stability and history of a filesystem are important factors when being considered for use in any environment, but especially so in a production environment.

XFS filesystems are full 64-bit filesystems composed of up to three general areas:

  • The data section, in which actual filesystem data and metadata are located.

  • The log, in which filesystem metadata changes are recorded transactionally. The log is typically written sequentially during normal filesystem operation and is read only when an XFS filesystem is mounted.

  • An optional real-time section, used to store the data of files that require constant, high-speed I/O. (Real-time subvolumes are actively under development for XFS under Linux, and should not be used at the present time.)

The data section of an XFS filesystem is divided into allocation groups, which are distinct subsets of the storage available in the data section of an XFS filesystem and are not visible to users. They are the conceptual equivalents of the cylinder groups used in the Berkeley FFS, dividing an XFS filesystem into discrete pools of storage space that typically range in size from .5 to 4GB. Each allocation group maintains its own data structures to manage free space, inodes, and allocated space within itself.

To improve performance when allocating disk space to files, XFS uses extent-based allocation rather than specifically allocating individual blocks to a file. The XFS filesystem also uses a sophisticated delayed-allocation mechanism when writing files to disk. This algorithm enables XFS to do a better job of extent allocation for new and updated files, and generally improves performance by reducing the number of distinct writes that XFS has to make to the filesystem.

In addition to using extents for locality and performance reasons, XFS applies some heuristics during directory creation that are designed to improve performance. Whenever a new directory is created in an XFS filesystem, it is located in a allocation group different from its parent, and a certain amount of contiguous space is preallocated for items in that directory. XFS also tries to allocate file inodes and extents as near as possible to the on-disk location of the directory in which they are located.

XFS allocates inodes as needed, instead of preallocating them when an XFS filesystem is created. Like other modern filesystems, the size of the logical blocks used in an XFS filesystem is flexible. XFS block sizes range from 512 bytes to 64KB, but file size limitations are still imposed by the Linux VFS layer. XFS also intrinsically supports sparse files, which are logically large files that can contain relatively little data, and which do not actually grow until data is added to them. Sparse files are perfect for filesystem storage of databases and other indexed files that may initially be small, but need to appear to be large.

XFS is a modern, high-performance filesystem that uses sophisticated algorithms, data structures, and advanced heuristics. The extensive testing and use that it has gotten as the primary filesystem used in SGI workstations for years makes it a proven performer that is well worth considering for use in production Linux environments.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.