While I was learning about inodes in ext4 file systems(or almost all Linux file systems), I found that directories also have inode entries. But I am a bit confused about a subtle aspect.

  • Are inode structures of directories similar to inode entries of files? link


  • Are they different from file inodes(like .txt, etc)? link

In both the articles, it is mentioned directories are just files mapping the file name to the inode values. But in the first link, it addresses the directory content(the map) as a separate data pool segment in a block of memory, and the inode table stores the inode value of the data pool while in the other, the author mentions (in the image) that the mapping is the inode structure of the directory.

So, the doubt arises, is the mapping content of directories stored in a separate block of memory and the inode entry in the inode table points to that particular memory block or, are they stored together (the map between the file name and the inode values) in the inode table itself as an inode entry without any extra block of memory containing the data of children files and directories?

Please help.

1 Answer 1


Your first reference (a single diagram) is (largely) junk. Just saying the inode points directly to "content_of_file_2" is a ridiculous simplification. I never saw the term "data pool" used either in this context.

What it does do is illustrate that the directory/file hierarchy is a tree, which is implemented by taking a tour through the inode list for each step.

Your second reference looks better, but I didn't read it fully. It is still not a full explanation, but then anything "complete" is going to have to deal with ten subtly different file systems.

I don't see why you think Ref 1 says that directories and files are handled similarly, and Ref 2 says they are different. The things that are common to both types of entry are handled the same. Where they become different, the file has a bunch of blocks that hold user data, and the directory has a bunch of blocks that hold file-system data (specifically, a table of names and inodes).

  • In both Ref 1 and Ref 2 it is mentioned that directories are treated as files. But if you observe in Ref 1, it says the inode table just contains the inode number of the directory and the pointer to the particular block of memory which contains the map of the file name and the inode, while in Ref 2, it says, the map is stored in the inode structure itself like pointers. Check this question there are 2 different answers.
    – gitartha
    Commented Sep 12, 2020 at 10:50
  • The "block of memory" is not RAM memory. It is just a disk block. The "pointers" are not memory pointers. They are just the sequence numbers of inodes or of disk blocks in the file system structures. I have zero confidence in LinuxHandbook.com -- it is just click-bait. Commented Sep 12, 2020 at 22:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .