Why is the root directory always stored in inode two?

I am trying to learn the Linux file system. Well, I mean the links below:

http://linuxgazette.net/issue21/ext2.html http://homepage.smc.edu/morgan_david/cs40/analyze-ext2.htm 

I have one doubt in the root directory, and doubt the following:

Why is the root directory always stored in inode number two, why not one or the other location?

Well, I'm not sure if this question makes any sense or not, but I just wanted to know, so I ask here.

If any body can send me some good place where I can get more information about the file system, then that would be really useful for me.

+4
source share
1 answer

The first inode number is 1. 0 is used as a NULL value to indicate that there is no inode. Inode 1 is used to track any bad blocks on the disk; it is essentially a hidden file containing bad blocks, so they will not be used by another file. Bad blocks can be written with e2fsck -c . The root directory of the file system is inode 2.

The meaning of the individual index number numbers differs in the file system. For ext4, you can find more information here ; in particular, see the table "Special inodes".

+12
source

Source: https://habr.com/ru/post/1438250/


All Articles