dcsimg

ext4 File System: Introduction and Benchmarks

Destined to become the default file system for the more popular Linux distributions, ext4 is out of experimental mode and gearing up for production environments. Here's what you need to know.

Benchmarking ext3 and ext4

I’m using several benchmarks for testing ext3 and ext4 (benchmarking file systems is a pet peeve of mine, but I digress). For now, I will be testing just iozone since it seems to be a popular benchmark that can produce a great deal of information.

I ran two sets of tests on ext3 and ext4. The first test builds the file systems with the defaults. The second test takes some of Ted Ts’o's advice and changes the mount options. Iozone produces a great deal of information but I chose to just show the results for read, reread, write, and rewrite for a 2GB file with a record length of 16,384 bytes. This shows the performance for a very large file (perhaps a KC and the Sunshine Band album in ogg format).

The results have 4 columns: Ext3 (default), Ext4 (default), Ext3 (performance), and Ext4 (performance). The “performance” options are not intended to produce the optimal performance but to illustrate what kind of performance you could obtain with some fairly easy changes. The commands to make the four files systems are:

% mke2fs -t ext3 /dev/sda1
% mke2fs -t ext4 /dev/sdb1
% mke2fs -t ext3 /dev/sda1
% mke2fs -t ext4 /dev/sdb1

The difference for the “performance” options are the mount options. For ext3, the entry in /etc/fstab is,

/dev/sda1  /data_ext3   ext3    defaults,data=writeback,noatime   0 0

For ext4, the mount options are:

/dev/sdb1  /data_ext4   ext4    defaults,data=writeback,noatime,barrier=0,extents,journal_checksum    0 0

The mount options used both the “noatime” and the “data=writeback” options. Whether these options are acceptable or not is up to you. By default ext3 does not use barriers (for good or bad). Ext4 uses barriers by default. So to make things equal I disabled barriers on ext4.

Benchmark Ext3 (default)
MB/s
Ext4 (default)
MB/s
Ext3 (performance)
MB/s
Ext4 (performance)
MB/s
Write 28.307 30.228 28.047 30.127
Rewrite 28.001 29.626 26.432 29.336
Read 55.791 108.701 105.565 109.889
Reread 55.765 108.884 105.156 109.600

One of the more interesting things you can take from the results is that the defaults for ext4 produce the top (or near the top) results for write, rewrite, read, and reread. Once all of the mount options are used with ext3, it achieved about the same performance of ext4 with or without the mount options.

The benchmarks may or may not be applicable to your situation but I do think they point out that the ext4 defaults produce very good performance relative to ext3. Performance being one of the goals in the development of ext4, I think the dev team hit the mark.

Summary

Ext3 is arguably the most popular file system in Linux. It has good enough performance and is very stable. But there have been a number of complaints about it, primarily in the areas of performance and overall capacity. Ext4 was really a fork of ext3 to add features. It was merged into the mainstream kernel a while ago but was marked as experimental. More recently, it was merged into the kernel to get more testing. Now, with the experimental label removed, ext4 has arrived and is ready for prime time.

For more info check out our interview with Ted Ts’o's, which points out that ext4 has some fantastic features and provides links to some great blogs about ext4 — particularly using ext4 on SSDs (Solid State Disks).

Should you move immediately to ext4? While you can migrate an ext3 file system to ext4, it requires a kernel capable of supporting ext4 (2.6.28 or newer or a kernel that has ext4 back-ported to it) and a relative new version of e2fsprogs. The quick benchmark I presented shows that ext4 has great performance using the defaults.

So while an immediate leap to ext4 may not be necessary, if you are currently using ext3 you should seriously start considering it for your default file system in the future.

Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62