Re:Good ext2 reference

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
zloba

Re:Good ext2 reference

Post by zloba »

In reply to this older thread

I'm trying to understand how to compute locations and sizes of various structures, mainly group descriptors and groups.

I'm terribly confused about this "s_first_data_block" business - with 1K blocks, it's 1, with 4k, it's 0. How do I use it, is there a formula or an algorithm, and why is it so?

I've looked at links in the FAQ, and I've googled... no luck.
The best document I've seen is the ext2-doc, yet it's l not complete enough:

here it gives _examples_ of disk organization - and _NO_ general algorithm. No clue about how this is supposed to work with 4K blocks.
The group descriptors are located on the first block following the block containing the superblock structure. Here's what one of the group descriptor looks like
So is the first set of group descriptors at 2K, or at 4K, or where?
The layout on disk is very predictable as long as you know a few basic information; block size, blocks per group, inodes per group. This information is all located in, or can be computed from, the superblock structure.
Ahm.. it's good to hear that it is predictable, but how do I predict it?
s_blocks_per_group:
32bit value indicating the total number of blocks per group. This value in combination with s_first_data_block can be used to determine the block groups boundaries.
Again, how? It's nice to know that it _can_ be used..

I've looked at kernel's ext2 sources and e2fsprogs - those have very few comments, but lots of abberviated identifiers, macros and all stuff to make it impossible to figure out.
----
the MIT "homepage" is actually an abstract overview, and it defers to e2fsprogs, which in turn refers to ext2-doc, and.. dead end. :(
Is the kernel code the only official definition of EXT2?

Any info is appreciated.

[edit by Candy] Don't resurrect 1.5 year old topics for a new request.[/edit]
Post Reply