Where are inodes stored at?
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.
LiorGolan
Updated on June 04, 2022Comments
-
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 almost 8 yearsThank 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 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 about 3 yearsWhy are it n Datablocks and n Block groups? Or are it n and m many?