Where are inodes stored at?

10,431

It depends on file system implementation. For example ext2fs/ext3fs choose to store inodes before data blocks within Block Group. The Second Extended File system (EXT2)

Remember inodes stored across all Block Groups. For example, inodes 1 to 32768 will get stored in Block Group-0 and inodes 32768 to 65536 stored on Block-Group-2 and so on. So, the answer to your question is: Inodes are stored in inode tables, and there's an inode table in every block group in the partition. enter image description here

Share:
10,431
LiorGolan
Author by

LiorGolan

Updated on June 04, 2022

Comments

  • LiorGolan
    LiorGolan almost 2 years

    I recently started learning about the Linux kernel and I just learned about inodes, which are data-structures containing meta-data of a file.

    Now, how do the OS find the associated inode of a file? (Let's say a string of a path). Moreover, where are those inode stored at? I mean, obviously they are stored on the disk but how is it all managed?

    One naive solution (I can come up with) would be to allocate on the disk a region designated only for inodes - What's actually done?

  • LiorGolan
    LiorGolan almost 8 years
    Thank you, but how exactly does the OS know where's this block located at for a given path? (let's say "/path/to/my/file")
  • Sparky
    Sparky almost 8 years
    @LiorGolan - Each directory entry must specify not only at least the path component name but also where to find its details (such as inode number). The root directory has a well known inode number (often #2). As mik1904 indicated, if you know the inode number, you can find out where on disk it is for a given file system. It then becomes an exercise of 1. read directory data for specified inode 2. Find name of next path component and its details 3. Repeat until the final component in the path is reached.
  • Niclas
    Niclas about 3 years
    Why are it n Datablocks and n Block groups? Or are it n and m many?