The primary purpose of the data blocks region is to provide the raw storage space where the content of files and the data associated with directories are written and read.
Files in EXT2 are allocated one or more more blocks. The locations of these blocks are recorded in the file's inode using a combination of direct and indirect blocks pointers.
Information:
Regular file
The actual text, images, videos, executables and any other data that constitutes a file.
Directoy data
Directories are stored as data block and referenced by an inode. They can be identified by the file typeEXT2_S_IFDIR
stored in thei_mode
field of the inode structure.
A directory file is a linked list of directory entry structures. Each structure contains the name of the entry, the inode associated with the data of this entry, and the distance within the directory file to the next entry.
Offset (bytes) | Size (bytes) | Description |
---|---|---|
0 | 4 | inode |
4 | 2 | rec_len |
6 | 1 | name_len |
7 | 1 | file_type |
8 | 0 - 255 | name |