theanine
theanine

Reputation: 1008

What are the EXT2 file system structure details?

I'm trying to wrap my head around the EXT2 file system, but I can't find a single place that shows me the EXT2 file system in detail.

I finally drew up a diagram myself. So I got that far. Now I'm trying to figure out the following (I've found some info already):

It's crazy to me that I can't find a single place that has this information.

EDIT: Also just found this, which means my bytes per block number is probably wrong:

#define EXT2_MIN_BLOCK_SIZE     1024
#define EXT2_MAX_BLOCK_SIZE     4096

Upvotes: 1

Views: 915

Answers (1)

thomasloven
thomasloven

Reputation: 73

I usually find my information about ext2 at the osdev wiki which in turn links here.

The number of bytes per block is 1024<<n where n is given in the superblock and is a 32 bit integer. So in theory, a block could be anywhere between 1024 and ... lots of bytes. Normally, block sizes of 1, 2, 4 or 8 kB are used, though depending on several factors such as partition size and expected average file size.

Each block group contains a single block bitmap of free blocks. This gives the constraint 8*block size to the number of blocks per block group. The same is true for inodes per block group. The actual values are found in the superblock.

This in turn gives a lower bound to the number of block groups needed to fill the partition.

Upvotes: 1

Related Questions