Life and times of the classic ext Linux filesystem
The Filer

The ext filesystem celebrates its 25th birthday next year. A brief tour of ext history will give you some insights into how this classic Linux filesystem works – and how it has evolved to meet users' needs.
When Linus Torvalds developed the first early versions of Linux in 1991, he used the Minix filesystem by Andrew S. Tanenbaum. The Minix filesystem was part of the legacy of the Minix Unix clone [1], which Tanenbaum created for teaching purposes. Some restrictions, such as a maximum file name length of 14 characters or the file size limit of 64MB, gave rise to the need for a filesystem specially developed for Linux: The birth of the Extended Filesystem, or ext, followed shortly afterward.
French software developer Rémy Card released the first version of ext in 1992, making it possible to save files of up to 2GB on Linux. The permissible length for file names grew to 255 characters. Although ext got many things right in the first version, it was hardly up to professional requirements. For some applications, ext suffered from severe fragmentation, and it was impossible to store different timestamps for access and modifications of the inode and file.
Successor Ext2
When designing ext2, the developers adopted many best practices and principles of the then-widespread Unix Berkeley Fast File System [2]: Accordingly, an ext2 filesystem divides the storage medium into blocks from a logical perspective, then strings the blocks together. The default block size is 4KB.
The blocks should generally be at least as large as the hard disk sectors. At that time, the typical size was 512 bytes, which, from a logical perspective, is a block containing eight sectors. For several years, however, many hard disks have come with 4KB sectors, so a block directly maps to a sector.
Ext2 also adds blocks together to create groups; given a block size of 4KB, 32,768 blocks typically form a group (of about 128MB). A modern hard disk with a capacity of 2TB holds many thousands of blocks and around 16,000 block groups.
The division into blocks and block groups helps to organize the storage space logically and optimize read and write access. As a rule, the system writes files within the same block group in order to minimize fragmentation and access times to the storage medium. If the system writes a file that is greater than the configured block size, the file accordingly occupies a number of blocks.
The division into fixed block sizes offers a decisive disadvantage: If a file does not occupy the block size of 4096 bytes (4KB), it is wasting space. A 96-byte file fills a complete 4KB block, and a 5092-byte file fills two. In either case, 4000 bytes are lost.
Inodes
An ext filesystem stores the files without metadata on the hard disk, so it needs a way to manage the size of the files, their ownerships, and the access permissions. Additionally, the filesystem needs space for the exact location on the hard drive so that the system can find the file quickly.
The developers of ext2 used inodes for this purpose: Every file and directory is represented by an inode, which contains the ownership and access information. The name inode stands for "index node," which is why the abbreviation i-node often appeared in the early years of ext2. An inode in ext2 has a default size of 128 bytes.
Directories
From the perspective of ext, folders are nothing more than special files that are home to a list of files. Each entry associates a file name with an inode number, the length, and content from the actual file name. When accessing a file, the system just needs to take a look at the inode, which represents the directory holding the file (Figure 1).

File name and inode number mappings do not need to be singular: A completely different file name that points to an already-referenced inode number is known as a hard link. A hard link typically is not readily visible to applications and users, and it can only point to objects in its own filesystem. Incidentally, the same principle applies to subdirectories. A subdirectory is also a special file, which the inode of the overlying directory references with its inode number as a file.
If you type ls -a
to list the contents of a folder, you will notice the .
and ..
entries. These entries are special properties of directories: When it creates a new folder, the system automatically generates them, and they cannot be deleted. Ext2 lists the entries .
and ..
in the directory with the inode number of the current or parent directory. The root directory always resides in inode number 2, so that the system can find it faster.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Direct Download
Read full article as PDF:
Price $2.95
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Find SysAdmin Jobs
News
-
KDE Plasma 5.27 Beta is Ready for Testing
The latest beta iteration of the KDE Plasma desktop is now available and includes some important additions and fixes.
-
Netrunner OS 23 Is Now Available
The latest version of this Linux distribution is now based on Debian Bullseye and is ready for installation and finally hits the KDE 5.20 branch of the desktop.
-
New Linux Distribution Built for Gamers
With a Gnome desktop that offers different layouts and a custom kernel, PikaOS is a great option for gamers of all types.
-
System76 Beefs Up Popular Pangolin Laptop
The darling of open-source-powered laptops and desktops will soon drop a new AMD Ryzen 7-powered version of their popular Pangolin laptop.
-
Nobara Project Is a Modified Version of Fedora with User-Friendly Fixes
If you're looking for a version of Fedora that includes third-party and proprietary packages, look no further than the Nobara Project.
-
Gnome 44 Now Has a Release Date
Gnome 44 will be officially released on March 22, 2023.
-
Nitrux 2.6 Available with Kernel 6.1 and a Major Change
The developers of Nitrux have officially released version 2.6 of their Linux distribution with plenty of new features to excite users.
-
Vanilla OS Initial Release Is Now Available
A stock GNOME experience with on-demand immutability finally sees its first production release.
-
Critical Linux Vulnerability Found to Impact SMB Servers
A Linux vulnerability with a CVSS score of 10 has been found to affect SMB servers and can lead to remote code execution.
-
Linux Mint 21.1 Now Available with Plenty of Look and Feel Changes
Vera has arrived and although it is still using kernel 5.15, there are plenty of improvements sure to please everyone.