Next | Internals of ext2fs | 27 |
The tail end of the inode records where the data is actually stored:
/* include/linux/ext2_fs.h */ struct ext2_inode { ... __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ ... };
Data blocks are addressed by with 32-bit numbers starting from 0 within each block group
The inode has room for 15 block addresses (that's EXT2_N_BLOCKS)
Elements 0..11 store the addresses of the first 12 blocks in the file
What if a file needs more than 12 blocks?
Block 12 does not contain any file data itself
Instead, it is stuffed full of addresses for more data blocks
It's called an indirect block
This suffices for files up to 2060 blocks
Block 13 is the double indirect block
This suffices for files up to 2060 + 4194304 blocks = 34.376 Gb
Block 14 is a triple indirect block
Next | Copyright © 2001 M. J. Dominus |