Imagine I have mounted a hard drive to the location /var/data/ of my Linux server, and I would like to print the content of a file.

cat /var/data/foo.txt

enter image description here

Ext4 is composed of several sections, for example:

  • super block
  • file system description
  • block bitmap
  • inode bitmap
  • etc.

My questions are:

  1. How does ext4 translate the file name to inode under the hood?
  2. in which section is the file name saved?
  3. in which section is the inode saved?
  4. in which section is the data saved?


superuser: How does the OS find files in the file system? [closed]


1 Answer 1


Ext4 is documented in detail in the kernel; I’ll give a summary answer to your question but you’ll find far more information there.

  1. Starting from a known inode (2 for the root directory of the file system, which corresponds to /var/data in your example, or an open file description for calls such as openat), the directory entries point to each successive inode for the path components, and finally the file you’re interested in.

  2. The file name is saved in a directory entry. Directories entries are stored in data blocks.

  3. Inodes are stored in inode tables.

  4. Data is stored in data blocks.

You must log in to answer this question.

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