The second extended filesystem, commonly written as ext2 or ext2fs, is the most basic and the most portable of the native Linux filesystems. It was the standard filesystem on Linux for a number of years, and, although more advanced filesystems have been developed, it remains in widespread use.
A filesystem is a way of organizing data on a computer system. On Linux and other Unix-like operating systems, the most obvious part of the main filesystem is the hierarchy of directories that starts with the root directory (designated by a forward slash), which contains a series of subdirectories, each of which, in turn, may contain further subdirectories, etc.A variant of this definition is the part of the entire hierarchy of directories or of the directory tree that is located on a single partition or disk. A partition is a logically independent section of a hard disk drive (HDD) that contains a single type of filesystem.
Each type of filesystem has its own set of rules for controlling the allocation of disk space to files and for associating data about each file (referred to as metadata) with that file, such as its name, the directory in which it is located, its access permissions and its creation date.
The earliest versions of Linux used the Minix filesystem, which was developed by Professor Andrew S. Tanenbaum for use in his MINIX operating system, a small clone of UNIX that was intended only for computer science education purposes. Although mostly free of bugs, it suffered from a small maximum partition size of 64 megabytes and a file name length limit of 14 characters. Thus, Linux developers soon began work on a replacement native filesystem.
The extended file system, also called ext, was released in April 1992 and was included in the Linux kernel (i.e, core of the operating system) version 0.96c. It overcame the main Minix limitations by allowing a huge increase in maximum partition size to two gigabytes and file names of up to 255 characters. However, ext still had problems: in particular, it lacked support for separate access for each user and group, and it also lacked timestamps for modifications to inodes and to data. An inode is a data structure on a filesystem on Unix-like operating systems that stores all of a file's metadata except its name. Another problem was that the linked lists data structure ext used to track free blocks and inodes gradually became unsorted as the filesystem was used, thus causing the filesystem to become fragmented (i.e., parts of files widely dispersed rather than in contiguous blocks).
As a solution for these problems, two new filesystems were developed and were included in the Linux kernel in January 1993: xiafs and ext2. The former was developed by computer scientist Frank Xia and was based on the Minix filesystem. Although stable and powerful, it was not well suited for future extension and only allowed a maximum file size of 64MB. Thus, support for it was dropped from the kernel beginning with version 2.1.21 (released in 1997), at which time support for ext was also discontinued.
Ext2 was initially designed by Rémy Card, a French software developer, based on ext but incorporating many ideas from the Berkeley Fast File System and with extensibility in mind. Also called the UNIX file system (UFS) and the BSD Fast File System, the Berkeley Fast File System is a distant descendant of the original filesystem used by Version 7 UNIX and has been incorporated into many UNIX and Unix-like operating systems.
Ext2 features (1) improved algorithms that greatly increase its speed, (2) additional timestamps (such as date of last access and date of last inode modification), (3) the ability to track the state of the filesystem and (4) support for a maximum file size of 4TB (one terabyte equals 1024 gigabytes). It maintains a special field in the superblock that indicates the status of the filesystem as either clean or dirty; the latter will trigger a utility to scan the filesystem for errors. As a result of these improvements, ext2 has completely superseded ext.
Ext2 is designed so that data is held in blocks of equal size on the HDD or other storage medium, although blocks can be different sizes on different partitions, different HDDs, etc. The size is set when the filesystem is created by the mke2fs program. The disadvantage of this approach is that an average of half of the block size is wasted for each file. For example, with a a block size of 1024 bytes, each 1025 byte file would require two blocks.
The main disadvantage of ext2 is that it is not a journaling file system (i.e., which maintains journals that minimize data corruption in the event of an interruption to the power supply). This was overcome with the development of ext3 and other native journaling filesystems. Ext3, which also features nearly complete compatibility with ext2, was added to the kernel beginning with version 2.4.15, which was released in November 2001.
Created December 17, 2006.