Ext4文件系统解析
--以cache.img为例,基于32位的文件系统
目录
Cache文件结构:
可见ext4文件系统cache中包含. .. hello lost+found hello_world.ko , 其中有四个Directory Entries
和一个Regular file
Cache文件系统结构
总体结构
Group 0 Padding |
ext4 Super Block |
Group Descriptors |
Reserved GDT Blocks |
Data Block Bitmap |
inode Bitmap |
inode Table |
Data Blocks |
1024 bytes |
1 block |
many blocks |
many blocks |
1 block |
1 block |
many blocks |
many more blocks |
超级块:
Offset |
Size |
Name |
Description |
||||||
0x0 |
__le32 |
s_inodes_count |
Total inode count. 0x2000=8192 |
||||||
0x4 |
__le32 |
s_blocks_count_lo |
Total block count. 0x8000=32768 |
||||||
0x8 |
__le32 |
s_r_blocks_count_lo |
This number of blocks can only be allocated by the super-user. |
||||||
0xC |
__le32 |
s_free_blocks_count_lo |
Free block count. 0x79f0=31216 |
||||||
0x10 |
__le32 |
s_free_inodes_count |
Free inode count. 0x1ff2=8178 |
||||||
0x14 |
__le32 |
s_first_data_block |
First data block. This must be at least 1 for 1k-block filesystems and is typically 0 for all other block sizes. |
||||||
0x18 |
__le32 |
s_log_block_size |
Block size is 2 ^ (10 + s_log_block_size).0x2=2^(10+2)=4096 |
||||||
0x1C |
__le32 |
s_log_cluster_size |
Cluster size is (2 ^ s_log_cluster_size) blocks if bigalloc is enabled, zero otherwise. |
||||||
0x20 |
__le32 |
s_blocks_per_group |
Blocks per group. 0x8000=32768 |
||||||
0x24 |
__le32 |
s_clusters_per_group |
Clusters per group, if bigalloc is enabled. |
||||||
0x28 |
__le32 |
s_inodes_per_group |
Inodes per group. 0x2000=8192 |
||||||
0x2C |
__le32 |
s_mtime |
Mount time, in seconds since the epoch. 0x573bc363 |
||||||
0x30 |
__le32 |
s_wtime |
Write time, in seconds since the epoch. 0x573bc363 |
||||||
0x34 |
__le16 |
s_mnt_count |
Number of mounts since the last fsck. 0x06 |
||||||
0x36 |
__le16 |
s_max_mnt_count |
Number of mounts beyond which a fsck is needed. 0xffff |
||||||
0x38 |
__le16 |
s_magic |
Magic signature, 0xEF53 0xEF53 |
||||||
0x3A |
__le16 |
s_state |
File system state. Valid values are:
|
||||||
0x3C |
__le16 |
s_errors |
Behaviour when detecting errors. One of:
|
||||||
0x3E |
__le16 |
s_minor_rev_level |
Minor revision level. 0x0 |
||||||
0x40 |
__le32 |
s_lastcheck |
Time of last check, in seconds since the epoch. 0x0 |
||||||
0x44 |
__le32 |
s_checkinterval |
Maximum time between checks, in seconds. 0x0 |
||||||
0x48 |