Middle
What information does an inode store?
sobes.tech AI
Answer from AI
The inode stores metadata about a file or directory in a filesystem. It does not contain the actual file data.
Key information stored in an inode:
- File type (regular file, directory, symbolic link, etc.)
- Access rights (owner, group, others; read, write, execute permissions)
- Number of hard links to this inode
- Owner user ID (UID)
- Owner group ID (GID)
- File size in bytes
- Timestamps:
- Last access time (atime)
- Last modification time (mtime)
- Last status change time (ctime)
- Disk block numbers where file data is stored
- Data block size
Example structure (conditional):
// Conditional representation of inode structure
struct inode {
// File metadata
unsigned int i_mode; // File type and permissions
unsigned int i_uid; // Owner UID
unsigned int i_gid; // Owner GID
unsigned int i_nlink; // Number of hard links
__time_t i_atime; // Last access time
__time_t i_mtime; // Last modification time
__time_t i_ctime; // Creation/modification time
unsigned long i_size; // File size
unsigned long i_blocks; // Number of blocks occupied by the file
unsigned int i_blksize; // Filesystem block size
// Data block addresses (direct, indirect, depending on FS)
unsigned int i_block[N_BLOCKS];
// + additional FS-specific information
};
Table with access rights examples in octal system:
| Octal value | Description |
|---|---|
| 777 | All rights for owner, group, others |
| 755 | rwx for owner, r-x for group and others |
| 644 | rw- for owner, r-- for group and others |