0

It's well known that the / directory has inode number 2 (see also Why does '/' have the inode 2). And we also know that hard links share the same inode number. So far so good.

Here's the confusing bit (notice the Inode: part):

$ stat /run
  File: /run
  Size: 940         Blocks: 0          IO Block: 4096   directory
Device: 16h/22d Inode: 2           Links: 32
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2018-09-10 10:22:18.198727482 +0800
Modify: 2018-09-10 02:47:58.655999930 +0800
Change: 2018-09-10 02:47:58.655999930 +0800
 Birth: -

The simple question is "Why do they have the same inode?" The /run directory is different from / and /run is not hardlink to /.

marked as duplicate by Stephen Kitt, muru, Mat, RalfFriedl, Ulrich Schwarz Sep 10 '18 at 5:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The base directory of any Ext2/3/4 file system uses inode 2 (see this question). However /run is usually a tmpfs and that rule doesn’t apply — what does mount | grep 'on /run ' output? – Stephen Kitt Sep 10 '18 at 4:34
  • @StephenKitt Thanks for finding that. So essentially it's because /run is root directory since it's a virtual filesystem. – Sergiy Kolodyazhnyy Sep 10 '18 at 4:43
  • Essentially yes, but that doesn’t explain everything because tmpfs file systems don’t have a fixed root inode. – Stephen Kitt Sep 10 '18 at 4:47
  • For me it's Inode: 14511 and it's tmpfs. / is inode 2 though (ext4). /tmp is tmpfs and inode 2860. Fedora 25 dom0 under Qubes OS 4.0 – Marcus Linsner Sep 10 '18 at 4:50

Browse other questions tagged or ask your own question.