Inodes
When you save a file on a Linux or Unix system, two big questions arise:
- Where is the file stored ?
- What information describes it ?
At first, you might think the file’s name is part of the file. Surprisingly, it’s not. File names are kept separately in directory entries. The real identity of a file lives inside something called an inode.

An inode (index node) is a special data structure that stores all the important metadata about a file or directory—except its name. Every file, directory, or symbolic link has an inode, and understanding them is essential for mastering how filesystems work.
What is an Inode ?
An inode (index node) is a special data structure that stores metadata about a file or directory—but not its name. Every file, directory, or symbolic link has its own inode. Without inodes, the system wouldn’t know:
- Who owns a file
- What permissions it has
- How large it is
- Where its data blocks are stored
In short, the inode is the backbone of a filesystem.
Exploring Inodes with Commands
Linux gives you direct ways to peek into inode structures:
ls -i→ Shows the inode number of a file.stat <file>→ Reveals inode metadata, such as size, permissions, timestamps, and link count.
Example:
$ ls -i myfile.txt
128849 myfile.txt
$ stat myfile.txt
File: myfile.txt
Size: 208 Blocks: 8 IO Block: 4096 regular file
Device: 805h/2053d Inode: 128849 Links: 1
Access: (0644/-rw-r--r--) Uid: (1000/user) Gid: (1000/user)
Access: 2025-08-14 11:23:01
Modify: 2025-08-14 11:22:17
Change: 2025-08-14 11:22:17
Here, the inode number is 128849, and the stat output shows all the information stored in that inode.
Contents of an Inode
An inode doesn’t store file names. Instead, it contains structured metadata about the file:
| Content | Description |
|---|---|
| File Type | Regular file, directory, symbolic link, or special type |
| Permissions | Read, write, execute bits for user, group, and others |
| Owner | UID (user ID) and GID (group ID) of the owner |
| Size | File size in bytes |
| Timestamps | Creation, last modification, and last access times |
| Link Count | Number of hard links pointing to the inode |
| Pointers | Addresses pointing to actual data blocks |
Inode Pointers Explained
So far, we’ve seen that inodes store metadata. Additionally, they also contain something equally important: pointers to the actual data blocks where file content lives.
Think of an inode as a table of contents in a book. The inode doesn’t hold the story itself—it holds page numbers telling the system where to find the story on the disk.
The 15 Pointers Inside an Inode
An inode has 15 pointers in total. These are designed to make small files fast to access and large files scalable:
- Direct Pointers (1–12):
- Each pointer goes straight to a data block.
- Perfect for small files.
- Example: A short text file may only need 1 or 2 of these.
- Single Indirect Pointer (13th):
- Points to a block that contains a list of data block addresses.
- Acts like an index page in a book.
- Double Indirect Pointer (14th):
- Points to a block → that points to another block → which then lists data block addresses.
- Like a table of contents that points to another table of contents.
- Triple Indirect Pointer (15th):
- Adds yet another layer.
- Useful for very large files, such as databases or VM images.
Visualizing the Pointers
Inode
├── Direct Pointers (12) → [Data blocks directly]
├── Single Indirect (1) → [Block → Data block pointers]
├── Double Indirect (1) → [Block → Block → Data block pointers]
└── Triple Indirect (1) → [Block → Block → Block → Data block pointers]
- Small files → Stored directly via the first 12 pointers (fast).
- Medium files → Use the single indirect pointer for extra space.
- Huge files → Expand through double and triple indirect pointers.
Key Facts About Inodes
Here are some important things to remember:
- Fixed Supply: When a filesystem is created, it has a fixed number of inodes. You can run out of inodes even if disk space is free.
- Allocation: Each new file consumes an inode.
- Separation of Name and Data: File names live in directory entries, while metadata and pointers live in inodes. This separation makes hard links possible.
