Crash Testing ext4 on Ubuntu
Server Training - Ubuntu Server Administration

Ubuntu 9.10 now uses Ext4 as the default.  It was tested under Jaunty Jackalope release and has finally gained the stability that was needed.  This article provides some basic information about ext4 and then provides some test results on a Ubuntu 9.10.


What is ext4?
The ext4 file system is a journaling file system which is a branch of ext3.  Ext3 has been so valuable in terms of stability and usability to Linux that the developers decided to fork ext3 to ext4 instead of incorporating the features of ext into ext3.  Those features include 64-bit storage limits and performance boosts.  The 2.6.28 Kernel included ext4 as stable code.

Advantages of ext4.
The advantages of ext4 are two.  Ext4 has increased filesystem support for volumes up to 1 exabyte, with files up to 16 terabytes. In addition, ext4 has increased performance. Currently, ext supports 16 terabyte filesystem and 2 terabyte file size.

Ext4 uses extents, which are a contiguous range of physical blocks on the hard drive. The key word here is contiguous, as you can see in the illustration the blocks are close together.  The advantage is large file size performance and the reduction of fragmentation because your data is placed in a more centralized area.  A extent can be up to 128MB of contiguous space with 4KB block size.  If you choose to use extents in ext4 you will not be able to go backwards to ext3 as the extents are not compatible with ext3.

ext4 filesystem

 

The ext3 filesystem is an excellent filesystem, stable and proven.  But, more often, especially with larger files you will see non-contiguous blocks, they will be spread out creating fragmentation.  Fragmentation slows disk access down as the operating system must seach for all of the blocks to provide the data requested.

 

ext4 filesystem

One of the interesting aspects of ext4 is that it allows for pre-allocation of disk space.  This allows for a contiguous space to be allocated for larger files, again increasing performance and reducing fragmentation.

Ext4 increases performance by using delayed allocation which delays the block allocation until the data is ready to be written to disk. This process improves allocation decisions by the operating system as it knows exactly the file size before being allocated.

Now 64,000 subdirectories can exist with ext4.  This is also available if the dir_index feature is enabled in ext3.
Now ext4 uses checksums to verify the journal.

If your system loses power and you need to run e2fsck to verify the filesystem, ext4 will ignore unallocated block groups to help improve performance.