File systems iconFile Systems
Data BlocksN blocksInode TableN blocksInodeBitmap1 blockBlockBitmap1 blockBlock GroupDescriptorN blocksSuperBlock1 block

Super block

The superblock contains all the information about the configuration of the filesystem. The information in the superblock contains fields such as the total number of inodes and blocks in the filesystem and how many are free, how many inodes and blocks are in each block group, when the filesystem was mounted (and if it was cleanly unmounted), when it was modified, what version of the filesystem it is and which OS created it.

The primary copy of the superblock is stored at an offset of 1024 bytes from the start of the file, block device or partition formatted with Ext2 and later variants (Ext3, Ext4). Its structure is mostly constant from Ext2 to Ext3 and Ext4 with only some minor changes. It is essential to mounting the filesystem. Since it is so important, backup copies of the superblock are stored in block groups throughout the filesystem.

The first version of ext-2 (revision 0) stores a copy at the start of every block group, along with backups of the group descriptor block(s). Because this can consume a considerable amount of space for large filesystems, later revisions can optionally reduce the number of backup copies by only putting backups in specific groups (this is the sparse superblock feature). The groups chosen are 0, 1 and powers of 3, 5 and 7

Revision 1 and higher of the filesystem also store extra fields, such as a volume name, a unique identification number, the inode size, and space for optional filesystem features to store configuration info.

All fields in the superblock (as in all other ext-2 structures) are stored on the disc in little endian  format, so a filesystem is portable between machines without having to know what machine it was created on.

Offset (bytes)Size (bytes)Description
04s_inodes_count
44s_blocks_count
84s_r_blocks_count
124s_free_blocks_count
164s_free_inodes_count
204s_first_data_block
244s_log_block_size
284s_log_frag_size
324s_blocks_per_group
364s_frags_per_group
404s_inodes_per_group
444s_mtime
484s_wtime
522s_mnt_count
542s_max_mnt_count
562s_magic
582s_state
602s_errors
622s_minor_rev_level
644s_lastcheck
684s_checkinterval
724s_creator_os
764s_rev_level
802s_def_resuid
822s_def_resgid

s_inodes_count

Offset: 0 bytes
Size: 4 bytes

32bit value indicating the total number of inodes, both used and free, in the file system. This value must be lower or equal to (s_inodes_per_group * number of block groups). It must be equal to the sum of the inodes defined in each block group.

Offset (bytes)Size (bytes)Description
844s_first_ino
882s_inode_size
902s_block_group_nr
924s_feature_compat
964s_feature_incompat
1004s_feature_ro_compat
10416s_uuid
12016s_volume_name
13664s_last_mounted
2004s_algo_bitmap

s_first_ino

Offset: 84 bytes
Size: 4 bytes

32bit value used as index to the first inode useable for standard files. In revision 0, the first non-reserved inode is fixed to 11 (EXT2_GOOD_OLD_FIRST_INO). In revision 1 and later this value may be set to any value.