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).
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 |
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)