DEV Community

Cover image for Superblock || Inode || Directory || Data Blocks
Shiva Charan
Shiva Charan

Posted on

Superblock || Inode || Directory || Data Blocks

πŸ—ΊοΈ 1. The Superblock: The Master Map

The superblock contains high-level information about the entire filesystem. It acts as a master controller that knows the "big picture," such as the total size of the filesystem and how much space is currently being used.


πŸͺͺ 2. The Inode: The File’s Identity Card

An inode (index node) is a record that stores almost everything about a specific file, such as who owns it and what its permissions are.

  • Crucial Fact: The inode does not store the file's name.

  • Instead, it stores the numbers of the data blocks where the file's content is physically located on the disk.

  • In a very real sense, the inode is the file, as it holds all the vital metadata and location data.


πŸ”— 3. The Directory Entry: The Name Link

Because the inode doesn't know the file's name, the system uses a directory entry to link a human-readable filename to a specific inode number.

  • A directory is essentially a simple list or "phonebook" where each entry consists of a filename paired with its inode number.

πŸ’½ 4. Data Blocks: The Storage Units

Data blocks are the physical parts of the disk where the actual content of your file is kept.

When you open a document, the computer:

  1. Looks up the inode
  2. Finds the block numbers listed inside it
  3. Reads those specific data blocks

to show you your information.


πŸ“š 5. Indirect Blocks: The Overflow List

An inode only has a fixed amount of space, which means it can only list a few data block numbers directly.

  • If a file is very large and needs more data blocks than the inode can hold, the system creates indirect blocks.

  • These are specialized blocks that don't hold your file's data, but instead hold a longer list of pointers to even more data blocks.

  • To find the contents of a massive file, the computer first goes to the inode, then to the indirect block, and finally to the actual data blocks.

Top comments (0)