Since December 2008, the Ext4 file system is in the Linux kernel and is fully supported by all major Linux distributions. In this article you'll find out if it's time to make your migration plans, or if you should wait a while.
The Ext4 file system is backward compatible to the Ext3 file system, which is backward compatible to the Ext2 file system, which was invented in the early 1990s. Remember how big a big hard drive was in those days? Exactly, about 40 MB (yes, megabytes, not gigabytes) was considered huge at those days. Hence, the Ext2 file system was never developed with the multi-terabyte volumes that people tend to create now. That also means that the default maximum file and volume sizes in Ext2 and also in Ext3 are limited. If the default block size of 4 KB is used, a file with a maximal size of 2 TB can be created, and the maximal size for a volume or partition is 8 TB. Given the storage needs that companies have nowadays, this imposes a serious limitation.
When starting the development of Ext4, initially there were two directions in the project team. The first was to develop Ext4 as a fork of Ext3, making it completely compatible with this file system. The other option was to develop a completely new file system with support for new features, such as b-tree indexing and an undelete feature. At the end, the compatibility option has prevailed, making Ext4 completely compatible with Ext3. Therefore, an upgrade option exists from Ext3 to Ext4, without any need to recreate the volume and copy all files over to the new Ext4 volume. You can mount an existing Ext3 volume as an Ext4 file system, allowing you to benefit from the more efficient engine that the Ext4 driver offers.
New features in Ext4
The most important limitation in Ext3, was the maximum size of files that could be used. Ext4 addresses this limitation by using extents. An extent is a contiguous group of blocks, and in Ext4, files can allocate extents instead of individual blocks. This makes allocation storage much more efficient, decreases fragmentation, and most important, allows for much larger files and volumes. The maximal file size in Ext4 is 16 TB, whereas the maximum volume size is even set to 1 EB (that is 1024 x 1024 x 1 TB). The use of extents is not the only method that Ext4 uses to decrease chances of fragmentation, another feature added to accomplish this goal is preallocation. This means that blocks can be reserved, even if they are not used immediately. Related to that, is the delayed allocation feature, which means that the actual writing of files is delayed until the last possible moment, which simultaneously increases performance and decreases fragmentation.
Migrating from Ext3 to Ext4
Migration from Ext3 to Ext4 is rather easy; just mount the Ext3 file system as an Ext4 file system, using
mount -t ext4 /dev/something /somewhere. This will automatically start using Ext4 features on the old Ext3 file system. There is a caveat though: if you do this, there is no way back. Once a file system uses specific Ext4 features, you cannot use it as an Ext3 file system anymore. Hence, you shouldn't forget to modify your
/etc/fstab to make sure that in the future your old Ext3 file system is mounted as Ext4 automatically after a system reboot.
Ext4 is the long awaited successor of the Ext3 file system. Since December 25, 2008, support is official in the Linux kernel. As migration is easy, and performance benefits are important, it's a good idea to start testing your migration from Ext3 to Ext4.
ABOUT THE AUTHOR: Sander van Vugt is an author and independent technical trainer, specializing in Linux since 1994. Vugt is also a technical consultant for high-availability (HA) clustering and performance optimization, as well as an expert on SLED 10 administration.