LiorGolan
LiorGolan

Reputation: 375

Where are inodes stored at?

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?

Upvotes: 15

Views: 15466

Answers (1)

mik1904
mik1904

Reputation: 1365

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

Upvotes: 26

Related Questions