The second extended filesystem is virtually the standard filesystem type used on all Linux distributions and installations. It is very powerful and flexible and has been extensively optimized for performance. To see that this is so we shall look at some of the differences between it and the other two systems you have seen to observe the improvements.
To start with, the inodes in the ext2 filesystem contain 15 block pointers, each 32 bits in size. These are arranged as 12 direct data block pointers and then one single, one double and one triple indirect block pointer.
Next, file names in ext2 are not limited to a fixed-sized record with a maximum of 14 characters as they are in the standard System V and minix filesystems. In ext2, directory entries are of variable length so as not to waste space and have a maximum length of 255 characters - more than enough for any application.
The layout of the filesystem on a disk partition has also been updated to make it faster and more efficient for data reads and writes. Figure 1 shows the top level structure of a partition.
The diagram shows that the partition consists of a boot block followed by a set of repetitions of a structure called a block group. The idea behind block groups is that they should improve the reliability of the filesystem and also improve its speed compared to the other filesystems we have examined.
The reliability is improved by using block groups because each block group contains a duplicate copy of system critical information, specifically the super block and the filesystem descriptors. This means that if one copy of this data should become corrupted, then it is always possible to obtain access to a backup copy.
The rest of the information in the filesystem, which consists of the block and mode bitmaps, the inode array and the file data blocks, is then distributed between the block groups so that each block group has a piece of each structure. This is shown in Figure 2, which gives the layout for a single block group.
In order to increase data access speed with this scheme, the ext2 filesystem uses a combination of several optimizations including:
There are many other facilities provided by the ext2 filesystem which make it the best current choice as a general purpose Linux filesystem. It also has the flexibility for much future expansion, and development is continuously in progress.