I am currently learning about the Linux file system. I have learned the following so far:

  • A directory is just a file that contains the following information: the file names, and their inode numbers.
  • There is an inode table that contains a data structure for each inode number. This data structure contains information such as Owner ID, Group ID, Size of file, etc.

Now does the inode data structure also contains the actual address of the file on disk, or does it only contain the address of some other data structure that knows the actual address of the file on disk?

1 Answer 1


This is dependent of the filesystem type. However, in most filesystems, the inode (or dinode) will contain the addresses of the first couple of data blocks (called "direct block") and then, for larger files, the addresses of the "indirect blocks" which themselves store pointers to additional data blocks.

See Inode_pointer_structure wikipedia's page for more details.

For learning purposes, I would recommend looking at UFS filesystem which has a relatively simple structure. See UFS diode struct, specifically di_db and di_ib for pointers to direct and indirect blocks.

  • 1
    Also see "How does Linux know the Location of File Data on Disk" unix.stackexchange.com/questions/74319/…
    – steve
    Commented Apr 22, 2017 at 21:56
  • Modern file systems, like Ext4 or Btrfs use extents, which are ranges of continuous blocks on the disk. Extents are referred to using a starting block, length pair. Of course, when the disk gets fragmented, you may have to use several extents for a larger file. This happens when a single long enough sequence of consecutive disk blocks is not available. Commented Apr 22, 2017 at 23:12

You must log in to answer this question.

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