Written by Christian Ahmer | 11/24/2023


The ext4 filesystem, introduced as a stable version in the Linux kernel in 2008, represents a significant advancement in the ext filesystem series. As the successor to ext3, ext4 builds upon the strengths of its predecessor while introducing new features and performance enhancements to meet modern computing needs.

A key enhancement in ext4 is its support for larger filesystem and file sizes. Ext4 can support volumes with sizes up to 1 exbibyte (EiB) and files with sizes up to 16 tebibytes (TiB), a substantial increase from the limits of ext3. This capacity expansion makes ext4 suitable for databases, scientific computing, and large-scale data centers where extensive data storage is a fundamental requirement.

Ext4 introduces an improved allocation algorithm known as "extents." Unlike the traditional block mapping approach used by ext2 and ext3, extents allow the filesystem to store information about contiguous sequences of blocks. An extent-based approach reduces fragmentation and improves large file performance by describing a range of contiguous blocks. This is particularly beneficial for large files, which can be described with fewer extents compared to the numerous individual blocks required in older systems.

Another significant feature is delayed allocation, which enhances performance and reduces fragmentation by delaying the decision of where to store new data until it is flushed to disk. This allows ext4 to optimize the placement of files, contributing to more efficient disk space utilization.

Ext4 also incorporates a multiblock allocator, which can allocate multiple blocks of data at once during a write operation. This coalescing of allocations reduces fragmentation and maximizes throughput, as it minimizes the number of disk seeks during file writes.

Journal checksums are a reliability feature introduced in ext4. They add an additional layer of filesystem integrity by preventing corruption of the journal itself—a risk that was present in ext3. The journal checksums ensure that before any data is written to the main file system, the integrity of the journal transaction can be verified.

Online defragmentation is another ext4 capability, which allows the filesystem to be defragmented while it is mounted and in use, thus avoiding downtime. This is crucial for systems that require high availability.

Barriers are an I/O safety feature that ext4 uses by default. They ensure the integrity of the filesystem in the event of a power failure by enforcing the order of writes to disk. This helps to prevent file system corruption by making sure that journal commits occur before any buffered data.

The filesystem also introduces the concept of "persistent preallocation," which allows applications to reserve a certain amount of space for files even before the data is written. This can be useful for applications such as media recording or streaming where it is essential to ensure that sufficient space is allocated for data that will be written in the future.

In addition to these features, ext4 improves timestamps, with support for dates up to the year 2108, and includes additional timestamp fields such as creation time, which were not available in ext3.

Despite these numerous advancements, ext4 maintains backward compatibility with ext3 and ext2, allowing for a straightforward transition to the newer filesystem. It has become the default filesystem choice for many Linux distributions, reflecting its reliability and performance characteristics that are well-suited for a wide range of storage needs.