The physical structure of Ext2 filesystems has been strongly influenced by the layout of the BSD filesystem []. A filesystem is made up of block groups. Block groups are analogous to BSD FFS's cylinder groups. However, block groups are not tied to the physical layout of the blocks on the disk, since modern drives tend to be optimized for sequential access and hide their physical geometry to the operating system.
The physical structure of a filesystem is represented on
figure .
Figure: Physical structure of an Ext2 filesystem
Each block group contains a redundant copy of crucial filesystem
control informations (superblock and the filesystem descriptors) and
also contains a part of the filesystem (a block bitmap, an inode
bitmap, a piece of the inode table, and data blocks). The structure of
a block group is represented on figure .
Figure: Structure of a block group
Using block groups is a big win in terms of reliability: since the control structures are replicated in each block group, it is easy to recover from a filesystem where the superblock has been corrupted. This structure also helps to get good performances: by reducing the distance between the inode table and the data blocks, it is possible to reduce the disk head seeks during I/O on files.
In Ext2fs, directories are managed as linked lists of variable
length entries. Each entry contains the inode number, the entry length,
the file name and its length. By using
variable length entries, it is possible to implement long file names without
wasting disk space in directories. The structure of a directory entry
is shown on figure .
Figure: Structure of a directory entry
As an example, figure represents the structure
of a directory containing three files: file1, long_file_name,
and f2.