2

using dumpe2fs on some ext4 partition, I get in the initial data, that the first inode is #11. However, if I ls -i on this disk root partition, I get that it's inode number is #2 (as expected). So... What is this “first partition” reported by dumpe2fs ?

5

#11 is the first "non-special" inode, that can be used for the first regularly created file or directory (usually used for lost+found). The number of that inode is saved in the filesystem superblock (s_first_ino), so technically it doesn't need to be #11, but mke2fs always sets it that way.

Most of the inodes from #0 to #10 have special purposes (e.g. #2 is the root directory) but some are reserved or used in non-upstream versions of the ext filesystem family. The usages are documented on kernel.org.

inode Number Purpose
0 n/a
1 List of defective blocks
2 Root directory
3 User quota
4 Group quota
5 Reserved for boot loaders
6 Undelete directory (reserved)
7 "resize inode"
8 Journal
9 "exclude" inode (reserved)
10 Replica inode (reserved)
3

Inode #1 -> #10 are "Reserved". From that reserved block #2 is the "root" directory of the filesystem

So #11 is typically the first real inode allocated... and that is probably lost+found

So:

% ls -ali / | awk '$1<=11'
 2 dr-xr-xr-x. 18 root root  4096 Jul 24  2019 ./
 2 dr-xr-xr-x. 18 root root  4096 Jul 24  2019 ../
 2 dr-xr-xr-x.  6 root root  4096 May  1 22:21 boot/
 3 drwxr-xr-x  17 root root  2980 Jun 30 20:49 dev/
11 drwx------.  2 root root 16384 Jul 24  2019 lost+found/
 1 dr-xr-xr-x  90 root root     0 Jun 30 20:49 proc/
 1 dr-xr-xr-x  13 root root     0 Jun 30 20:49 sys/

The directories boot dev proc and sys are all mountpoints, so the ls output is showing the inode numbers inside those filesystems. That leaves . and .. as #2 and lost+found as #11

In early versions of ext2 this reserved count was fixed. In later versions it's configurable in the superblock, and that's the value that dump2fs is reporting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.