(Last Updated On: June 11, 2019)

Introduction

In your enterprise and personal deployments, we bet you have come to the point where you were at a crossroad on which file system road you should take. There is a large number of file systems out there and choosing the one for the particular application you would wish to accomplish can sometimes be difficult.

Considering the trade-offs that exist among the huge number if options, a good research and understanding can be a boon and a life saver for you. When considering whether to adopt a file system choice, you should consider how large the file system needs to be, what unique features it should have, and how it performs under your workload. With that in mind this article zooms the lens in on ext4 and xfs file systems. It investigates their features, their subtle differences and example use-cases for both of them. Let us begin..

The XFS File System

XFS file system was developed in the early 1990s by SGI (Silicon Graphics, Inc.) and has a long history of running on extremely large servers and storage arrays. This file system prides itself in being robust and mature 64-bit journaling file system that supports very large files and file systems on a single node or host. Yhe concept of journaling makes sure theat there is file system intergrity in case a system crashes. Journaling does this by keeping a record of file system operations that can be replayed when the system is restarted and the file system remounted. XFS has a long history and reputation of operating in environments that require high performance and scalability and hence is routinely measured as one of the highest performing file systems on large systems with enterprise workloads.

Features of XFS

  • As mentioned it supports metadata journaling, which facilitates quicker crash recovery.
  • Tightly integrated backup and restore utilities
  • Online defragmentation and growth: This filesystem can be defragmented and enlarged while mounted and active.
  • Comprehensive diagnostics capabilities
  • Scalable and fast repair utilities. XFS scales to exabytes more than 500TB
  • Optimizations for streaming video workloads
  • B-tree indexing for scalability of free space management
  • Ability to support a large number of concurrent operations
  • Extensive run-time metadata consistency checking
  • Sophisticated metadata read-ahead algorithms
  • Delayed, Extent-based allocation
  • Dynamically allocated inodes
  • Extended attributes (xattr): This allows the system to associate several additional name/value pairs per file. It is enabled by default.
  • Compared to Ext4, XFS has a relatively poor performance for single threaded, metadata-intensive workloads. This includes workload that creates or deletes large numbers of small files in a single thread.
  • Quota journaling: This avoids the need for lengthy quota consistency checks after a crash.

The Ext4 File System

The Ext family which has its roots in the Minix Operating system is one of the file systems that has experienced evolution through its lifetime. The original EXT file system (Extended) was written by Rémy Card and released with Linux in 1992 to overcome some size limitations of the Minix file system (opensource.com). Ext4 is the fourth generation of the Ext file system family and it can read and write to Ext2 or Ext3 file systems, but the Ext4 file-system format is not compatible with Ext2 and Ext3 drivers. Aside from that, Ext4 adds several new and improved features that are common with most modern file systems.

Features of Ext4 File system

  • Extent-based metadata: A more compact and efficient way to track utilized space in a file system including Delayed Allocation.
  • Delayed allocation: This allows the file system to postpone selection of the permanent location for newly written user data until the data is flushed to disk. Consequently, higher performance is achieved since it can allow for larger, more contiguous allocations, allowing the file system to make decisions with much better information.
  • Journal checksumming
  • Large storage support
  • Multi-block allocation
  • Stripe-aware allocation
  • Persistent pre-allocation
  • File system repair time (fsck) in Ext4 is much faster than in Ext2 and Ext3. This is possible because ext4 labels unallocated block groups and inode table sections accordingly, which allows them to be skipped during a file system check.
  • Quota journaling — This avoids the need for lengthy quota consistency checks after a crash.
  • Extended attributes (xattr) — This allows the system to associate several additional name and value pairs per file.
  • Compared to XFS, Ext4 handles less file sizes for example maximum supported size for Ext4 in RHEL 7 is 16TB compared to 500TB in XFS.

Conclusion

Choosing the file system that satisfies your specific application needs requires consultation and research of various parameters. This article outlines the benefits of Ext4 and XFS file system options and to assist you make the decision regarding the right file system for your application environments. Thank you for spending your time here. Other helpful guides and articles are provided on the links below.

How to resize an ext2/3/4 and XFS root partition without LVM

Understanding and Working With BtrFS Filesystem in Linux

How To Create a Swap File on Linux