The ext filesystem – a four-generation retrospective

Journaling

Over time, more filesystems have been added to the Linux kernel, and ReiserFS, JFS, and XFS were superior to ext2 in at least one way: Thanks to journaling, an fsck was much faster than in ext2. With ever-increasing volumes, filesystem checking contributes significantly to the time the operating system is occupied. In 1998, Tweedie published a design study with initial implementation approaches for ext2 with a journaling function [9].

During the discussion on write performance problems with large files [10], the developer reported on the kernel mailing list that he was working on this extension of the filesystem [11]. The management of many files in a directory was tricky for ext2. The developers addressed this with the introduction of H-tree, a special form of the B-tree.

With the introduction of journaling, the H-tree for large directories, and the ability to enlarge ext FS online, ext3 was born. Since version 2.4.15 (November 2001), it has been available as a Linux kernel extension [12]. The highlight here is that a conversion of ext2 to its successor was (and still is) possible without the inconvenience of shifting data around.

The filesystem developers kept their word. More than that, a way back was even possible. Simply run the fsck.ext2 command against an ext3 partition, and you could mount it again as a normal ext2 FS in the directory tree. For a more elegant approach, you have the tune2fs tool (Listing 1).

Listing 1

From ext2 to ext3 and Back

# mkfs.ext2 /dev/sdb1
mke2fs 1.42.7 (21-Jan-2013)
Filesystem label =
OS Type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
[...]
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
# mount /dev/sdb1 /tmp/mnt/
# grep mnt /proc/mounts
/dev/sdb1 /tmp/mnt ext2 rw,relatime 0 0
# umount /tmp/mnt/
# tune2fs -j /dev/sdb1
tune2fs 1.42.7 (21-Jan-2013)
Creating journal inode: done
# mount /dev/sdb1 /tmp/mnt/
# grep mnt /proc/mounts
/dev/sdb1 /tmp/mnt ext3 rw,relatime,data=ordered 0 0
# umount /tmp/mnt/
# tune2fs -O ^has_journal,^dir_index /dev/sdb1
tune2fs 1.42.7 (21-Jan-2013)
# mount /dev/sdb1 /tmp/mnt/
# grep mnt /proc/mounts
/dev/sdb1 /tmp/mnt ext2 rw,relatime 0 0

Going Back

Converting an ext3 partition back to ext2 appears useful when performance is more important than filesystem integrity. A journal requires more writes to the disk than in ext2, and unfortunately, it cannot be switched off separately. As Listing 1 shows, the conversion is fairly painless and not a one-way street.

History, however, has repeated itself: As size and performance requirements of the managed media grew, ext3 began to reach its limits, so ext4 was created from a kind of patched ext3 [13]. First characterized as experimental, the filesystem has been tagged as production since kernel version 2.6.28 (October 2008).

Continuity

Continuity was also evident on the developer front. Ts'o, already involved in the grandfather of ext4 and the maintainer of ext3, also took the youngest representative of the ext FS family under his wing. Most importantly: you can convert an existing ext3 without data loss or migration.

Unfortunately, some new features of ext4 require a change in the on-disk format. If you do without them, again the conversion is not a one-way operation, and again the tune2fs tool provides valuable service.

The light version of the tool allows the user to mount an ext3 partition with the ext4 driver (Figure 3).

Figure 3: The kernel driver makes some ext4 improvements available to ext3 partitions.

The relationships within the ext FS family are transitive – the compatibility of ext2 with ext3 and ext3 with ext4 results in some compatibility between ext2 and ext4. Table 2 shows which kernel driver can handle which filesystem, without requiring the user to manipulate the data on the disk.

Table 2

Driver Compatibility

Filesystem

ext2

ext3

ext4

ext2

Yes

Yes

Yes

ext3

No

Yes

Yes

ext4 (with ext3 on-disk format)

No

Yes

Yes

ext4

No

No

Yes

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Choose a Filesystem

    Every Linux computer needs a filesystem, and users often choose a filesystem by habit or by default. But, if you're seeking stability, versatility, or a small performance advantage, it pays to take a closer look.

  • File systems

    Many users just opt for the defaults and don’t think about the file system when they install Linux. But if better performance is your goal, it pays to do some shopping.

  • Ext4

    The newest child in the Ext filesystem family provides better performance and supports bigger filesystems. Are you ready for Ext4?

  • Kernel: Ext 4 Filesystem Moves Beyond Developer Status

    Theodore Ts'o has renamed the Ext4 filesystem, for which he has been responsible for source and documentation, from extdev to ext4. Linus Torvalds has also incorporated the change into his personal source tree for the upcoming Kernel 2.6.28.

  • Configuring Filesystems

    Although most Linux distributions today have simple-to-use graphical interfaces for setting up and managing filesystems, knowing how to perform those tasks from the command line is a valuable skill. We’ll show you how to configure and manage filesystems with mkfs, df, du, and fsck.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News