Ext2
|
- The title of this article is incorrect because of technical limitations. The correct title is ext2.
The ext2 or second extended file system was the standard filesystem used on the Linux operating system for a number of years and remains in wide use. It was initially designed by Rémy Card based on concepts from the extended file system. It is quite fast, enough so that it is used as the standard against which to measure many benchmarks. Its main drawback is that it is not a journaling file system. Its successor, ext3, is a journalled filesystem and is almost completely compatible with ext2.
The canonical implementation of ext2 is the ext2fs filesystem driver in the Linux kernel. Other implementations (of varying quality and completeness) exist in HURD, some BSD kernels and as third-party Microsoft Windows drivers. ext2 was the default filesystem in the Red Hat, Fedora and Debian Linux distributions until supplanted more recently by ext3.
Contents |
History
The early development of the Linux kernel was made as a cross-development under the Minix operating system. Naturally, it was the most obvious decision to implement the Minix file system as Linux's first file system. Minix file system was pretty free of bugs, but had some limitations like being able to handle only 64 megabytes of data, due to its 16-bit address space and accepted file name with no more than 14 characters. Because of these limitations, work began on the implementation of new file systems for the Linux operating system.
To ease the addition of new filesystems into the Linux kernel, a virtual file system was developed, called VFS. After its integration to the kernel, the extended file system (ext) was released as the first file system designed for Linux in April 1992 and it was included in Linux version 0.96c. The ext file system solved the two major problems in the Minix file system (maximum partition size and file name length limitation to 14 characters), now allowing 2 gigabytes of data and a 255 characters filename. But it still had problems: there was no support for separate access, inode modification and data modification timestamps.
As a solution for these problems, two new filesystems were developed in January 1993: the Xia file system and the second extended file system (ext2). The ext2 file system was based on the extended file system with many reorganizations and many improvements and was designed with evolution in mind, containing space for future developments.
The ext2 file system has a maximum data size of 4 terabytes, maximum filename length of 255 characters, and has variable length block size.
Design
- Block group
- Every ext2 filesystem is divided up into block groups, each of which has its own:
- Superblock
- Group descriptors
- Block bitmap
- Inode bitmap
- Inode table
- Data blocks
- Block groups are similar to cylinder groups in Berkeley FFS, where they were introduced to retard file fragmentation.
- Superblock
- The superblock contains metadata describing the entire filesystem:
- Number of inodes
- Number of blocks
- Reserved block count
- First data block number
- Block size
- Fragment size
- Number of blocks per group
- Number of fragments per group
- Number of inodes per group
- Mount time
- Write time
- Mount count
- Maximal mount count
- Magic signature
- File system state: valid (unmounted cleanly) or error
- Error detection behavior
- Minor revision level
- Time the file system was last checked
- Maximum time between checks
- Default user & group ID for reserved blocks
- Inodes
- Inodes contain file metadata:
- File mode
- User ID (uid)
- Group ID (gid)
- File size, in bytes
- Last file access time (atime)
- Inode change time (ctime)
- Last file modification time (mtime)
- Deletion time (dtime)
- Link count
- Block count
- File type
- File attributes
- List of block addresses, each of which may to:
- A block containing raw file data (direct address)
- An indirect block containing direct addresses (indirect address)
- A doubly-indirect block containing indirect addresses (doubly-indirect address)
- A triply-indirect block containing doubly-indirect addresses (triply-indirect address)
- Directories
- Represented as a list of directory entries, each of which contains an inode number and a filename.
- Files
-
- Regular files
- Represented as a list of blocks, pointers for which go into indirect nodes. Blocks are headerless and contain raw data.
- Links
- Hard links
- Symbolic links
- Special files
-
- Block devices
- Character devices
- FIFOs
See also
External links
- Design and Implementation of the Second Extended Filesystem (http://web.mit.edu/tytso/www/linux/ext2intro.html)
- Ext2fs Home Page (http://e2fsprogs.sourceforge.net/ext2.html)
- ext2 file system driver for MS Windows NT/2000/XP (http://ext2fsd.sourceforge.net/)
Template:Linux-stubde:Ext2 es:EXT2 fr:Ext2 it:Ext2 he:EXT2 ja:Ext2 pl:Ext2 pt:Ext2 sk:ext2