The first step in implementing an Ext2 driver is to find, extract, and parse the superblock. Each block group has an array of inodes it is responsible for, and conversely every inode within a file system belongs to one of such tables (and one of such block groups). This lets the inodes themselves have a well-defined size which lets them be placed in easily indexed arrays. Instead, they link to the blocks that actually contain the data. Inodes do not contain the data of the file / directory / etc. Depending upon the revision of Ext2 used, some or all block groups may also contain a backup copy of the Superblock and the Block Group Descriptor Table.Īn inode is a structure on the disk that represents a file, directory, symbolic link, etc.A table of inode structures that belong to the group.A bitmap of allocated inodes within the group.A bitmap of free/allocated blocks within the group.The size of blocks can be determined by reading the field starting at byte 24 in the Superblock.īlocks, along with inodes, are divided up into "block groups." These are nothing more than contiguous groups of blocks.Įach block group reserves a few of its blocks for special purposes such as: The size of blocks need not be the same size as the sector size of the disk the file system resides on. The Ext2 file system divides up disk space into logical blocks of contiguous space. Important Note: All values are little-endian unless otherwise specified What is a Block? 4.2 Finding an inode inside of a Block Group.4.1 Determining which Block Group contains an Inode.3.1 Locating the Block Group Descriptor Table.2.2 Determining the Number of Block Groups.Be sure to buy him a beer the next time you see him.
Note: Most of the information here is based off of work done by Dave Poirier on the ext2-doc project (see the links section) which is graciously released under the GNU Free Documentation License. Further, some (if not all) groups are required to contain backups of important data that can be used to rebuild the file system in the event of disaster. Organizationally, it divides disk space up into groups called "block groups." Having these groups results in distribution of data across the disk which helps to minimize head movement as well as the impact of fragmentation. It has native support for UNIX ownership / access rights, symbolic- and hard-links, and other properties that are common among UNIX-like operating systems. The Second Extended Filesystem ( ext2fs) is a rewrite of the original Extended Filesystem and as such, is also based around the concept of "inodes." Ext2 served as the de facto filesystem of Linux for nearly a decade from the early 1990s to the early 2000s when it was superseded by the journaling file systems ext3 and ReiserFS.