Written by Christian Ahmer | 11/24/2023


Ext2, or the second extended filesystem, is a discontinued file system for the Linux kernel that was initially designed by Rémy Card as a replacement for the extended file system (ext). Its design is emblematic of the traditional UNIX filesystem, featuring concepts such as inodes, blocks, and directories.

The inode structure is a defining feature of ext2. Each inode contains information about a filesystem object, which could be a file, directory, or symbolic link. The inode stores metadata, but not the filename or data content. This information includes ownership details, access mode (read, write, execute permissions), and pointers to the data blocks on the disk that contain the object's content.

Ext2 organizes data in blocks, which are typically 1, 2, or 4 KB in size, though this can be configured up to 64KB on systems with large memory pages. These blocks are grouped into block groups, intended to cluster related directories and files and to improve performance by minimizing disk head travel time. Each block group contains a copy of the superblock and block group descriptor table, which can be critical in file system recovery in case the main superblock is corrupted.

The directory structure of ext2 is straightforward. A directory is a special file that contains a list of filenames and their corresponding inodes. When a file is opened, the directory is searched to find the inode number associated with the filename. The file system then uses the inode to access the actual data. Ext2 uses a linked list to store directory entries, which can make searching for files slower as the directory size increases. Subsequent filesystems like ext3 and ext4 introduced improvements to this structure.

Ext2 does not include journaling functionality, which means it is susceptible to data corruption in the event of an improper shutdown. However, this also means it is lighter on system resources and, as a result, was once the filesystem of choice for flash-based storage devices like USB flash drives and SD cards, where write cycles are a concern.

One of the key advantages of ext2 was that it allowed for large filesystems with a large number of files. It supports filesystem sizes up to 32 TB and file sizes up to 2 TB, which was quite significant at the time of its introduction.

Despite its advantages, ext2 has been largely supplanted by ext3 and ext4, its successors that offer journaling and other improvements. However, ext2 remains a useful tool in certain situations. It can be used for partitions that don't need journaling, like boot partitions, or in environments where minimizing write operations is essential, as in the case of flash memory mediums.

Overall, ext2 is an important part of the historical Linux landscape. Its legacy lies in the foundation it provided for its more advanced successors, and it continues to be a testament to the enduring nature of Unix-like filesystem concepts.