Ext2, Ext3, Ext4 file systems

Ext2, Ext3, Ext4 are default file systems for most of Linux operating systems. They are all based on the UFS (UNIX File System). Ext3 and Ext4 introduced file system journaling.

Ext2, ext3 file system layout

The schematic layout of ext2, ext3 file systems.

The layout of ext2, ext3 file systems starts with an optional sectionreserved area. The rest part of the space is divided and consists of special sections, called block groups. Each block group (except for the last one) includes the same number of blocks. Blocks contain: file names, metadata, file content.

Ext2, Ext3, Ext4: Reserved area

Reserved area of ExtX file systems:

  • Boot Code (0-1023 bytes) OPTIONAL
  • Superblock (1023-2047 bytes)

Ext2, Ext3, Ext4: Boot code

Ext2, Ext3, Ext4 file system which contains the OS kernel, may have boot code. Boot code occupies the first 1024 bytes and is located in the reserved area, just before the superblock. It will be executed after passing the control from MBR (First 512 bytes of the current disk).

Ext2, Ext3, Ext4: Superblock

Superblock (size: 1024 bytes) is located in bytes: 1023 – 2047. In the first block of each block group, you can find the backup copy of superblock. Superblock contains the basis size and configuration information of the file system:

  • Block size;
  • The total number of blocks;
  • Number of blocks in a block group;
  • Number of reserved blocks before the 1st block group;
  • The total number of inodes;
  • Number of inodes per block group;
  • Volume name;
  • The last write time;
  • The last mount time;
  • The last mount pathl;
  • Dirty bit;
  • Total number of free inodes and blocks.

Superblock data structures

May be continued… а зачем? Правильно! Незачем!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s