Advanced Topic 36 of 51 Operating Systems
Inodes
Metadata records describing files in Unix file systems.
How it works
An inode is a Unix file-system data structure that stores a file's metadata: type, permissions, owner, size, timestamps, link count and pointers to its data blocks, but not its name. Directories map names to inode numbers, so one inode can have several names, called hard links. Pointers include direct blocks plus single, double and triple indirect blocks to support large files.
Step-by-step walkthrough
- A directory maps a name to an inode number.
- The inode stores size, owner, permissions and times.
- It also holds pointers to the data blocks.
- More pointers lead to further blocks.
- The file name is not part of the inode, so hard links are possible.
Where it is used
Commands like stat and ls -i show inode data. File systems have a fixed or dynamic inode table, and tools such as find and rsync use inode information to detect hard links.
Common pitfall
Running out of inodes prevents creating new files even with free space, which happens with millions of tiny files. Hard links cannot cross file systems or link to directories. Deleting a name does not free data while other links or open handles remain. Renames within a file system change directories but not the inode.
Where it fits in the course
Inodes is topic 36 of 51 in Operating Systems, rated Advanced. It follows File Systems. The next topic is Directory Structures.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Operating Systems quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Operating Systems quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Inodes?
Where do people use Inodes?
What is the most common mistake with Inodes?
What should I learn before this topic?
How can I practice it?
Is Inodes hard to learn?
How long does it take to learn Inodes?
Which topics are related to Inodes?
What should I study after Inodes?
Related topics
- File Systems (Operating Systems)
- Directory Structures (Operating Systems)
- Memory Mapped Files (Operating Systems)
- File Allocation Methods (Operating Systems)