Inode Table
The inode table is used to keep track of every directory, regular file, symbolic link, or special file; their location, size, type and access rights are all stored in inodes. There is no filename stored in the inode itself, names are contained in directory files only
There is one inode table per block group and it can be located by reading the bg_inode_table in its associated group descriptor. There are s_inodes_per_group inodes per table.
Each inode contain the information about a single physical file on the system. A file can be a directory, a socket, a buffer, character or block device, symbolic link or a regular file. So an inode can be seen as a block of information related to an entity, describing its location on disk, its size and its owner. An inode looks like this:
Offset (bytes) | Size (bytes) | Description |
---|---|---|
0 | 2 | i_mode |
2 | 2 | i_uid |
4 | 4 | i_size |
8 | 4 | i_atime |
12 | 4 | i_ctime |
16 | 4 | i_mtime |
20 | 4 | i_dtime |
24 | 2 | i_gid |
26 | 2 | i_links_count |
28 | 4 | i_blocks |
32 | 4 | i_flags |
36 | 4 | i_osd1 |
40 | 15 * 4 | i_block |
100 | 4 | i_generation |
104 | 4 | i_file_acl |
108 | 4 | i_dir_acl |
112 | 4 | i_faddr |
116 | 12 | i_osd2 |
i_mode
16bit value used to indicate the format of the described file and the access rights. Here are the possible values, which can be combined in various ways:
Offset (bytes) | Size (bytes) | Description |
---|---|---|
EXT2_S_IFSOCK | 0xc000 | socket |
EXT2_S_IFLNK | 0xa000 | symbolic link |
EXT2_S_IFREG | 0x8000 | regular file |
EXT2_S_IFBLK | 0x6000 | block device |
EXT2_S_IFDIR | 0x4000 | directory |
EXT2_S_IFCHR | 0x2000 | character device |
EXT2_S_IFIFO | 0x1000 | fifo |
EXT2_S_ISUID | 0x0800 | Set process User ID |
EXT2_S_ISGID | 0x0400 | Set process Group ID |
EXT2_S_ISVTX | 0x0200 | sticky bit |
EXT2_S_IRUSR | 0x0100 | user read |
EXT2_S_IWUSR | 0x0080 | user write |
EXT2_S_IXUSR | 0x0040 | user execute |
EXT2_S_IRGRP | 0x0020 | group read |
EXT2_S_IWGRP | 0x0010 | group write |
EXT2_S_IXGRP | 0x0008 | group execute |
EXT2_S_IROTH | 0x0004 | others read |
EXT2_S_IWOTH | 0x0002 | others write |
EXT2_S_IXOTH | 0x0001 | others execute |
Offset (bytes) | Size (bytes) | Description |
---|---|---|
EXT2_BAD_INO | 1 | bad blocks inode |
EXT2_ROOT_INO | 2 | root directory inode |
EXT2_ACL_IDX_INO | 3 | ACL index inode (deprecated?) |
EXT2_ACL_DATA_INO | 4 | ACL data inode (deprecated?) |
EXT2_BOOT_LOADER_INO | 5 | boot loader inode |
EXT2_UNDEL_DIR_INO | 6 | undelete directory inode |