The first block in each Ext2 partition is never managed by the Ext2 filesystem, because it is reserved for the partition boot sector (see Appendix A). The rest of the Ext2 partition is split into block groups , each of which has the layout shown in Figure 18-1. As you will notice from the figure, some data structures must fit in exactly one block, while others may require more than one block. All the block groups in the filesystem have the same size and are stored sequentially, thus the kernel can derive the location of a block group in a disk simply from its integer index.
Figure 18-1. Layouts of an Ext2 partition and of an Ext2 block group
Block groups reduce file fragmentation, because the kernel tries to keep the data blocks belonging to a file in the same block group, if possible. Each block in a block group contains one of the following pieces of information:
A copy of the filesystem's superblock
A copy of the group of block group descriptors
A data block bitmap
An inode bitmap
A table of inodes
A chunk of data that belongs to a file; i.e., data blocks
If a block does not contain any meaningful information, it is said to be free.
As you can see from Figure 18-1, both the superblock and the group descriptors are duplicated in each block group. Only the superblock and the group descriptors included in block group 0 are used by the kernel, while the remaining superblocks ...