In POSIX, you can theoretically use inode zero

32 mfrw 5 5/31/2025, 8:57:12 AM utcc.utoronto.ca ↗

Comments (5)

the_mitsuhiko · 9m ago
The OpenBSD UFS documentation says this:

> The root inode is the root of the file system. Inode 0 can't be used for normal purposes and historically bad blocks were linked to inode 1 (inode 1 is no longer used for this purpose; however, numerous dump tapes make this assumption, so we are stuck with it). Thus the root inode is 2.

This is also echoed on the wikipedia page for it.

The linux Kernel also has this comment for why it does not dish out that inode for shmem for instance:

> Userspace may rely on the the inode number being non-zero. For example, glibc simply ignores files with zero i_ino in unlink() and other places.

On macOS it's pretty clear that inode 0 is reserved:

> Users of getdirentries() should skip entries with d_fileno = 0, as such entries represent files which have been deleted but not yet removed from the directory entry

nulld3v · 31m ago
Also, there seems to be an effort brewing in the kernel to push userspace away from depending on inode #s due to difficulty in guaranting uniqueness and stability across reboots. https://youtu.be/TNWK1zbTMOU
AndrewDavis · 18m ago
They definitely aren't unique even without reboots. Postfix uses the inode number as a queue id. At $dayjob we've seen reuse surprisingly quickly, even within a few hours. Which is a little annoying when we're log spelunking and we get two sets of results because of the repeating id!

(there is now a long queue id option which adds a time component)

quotemstr · 10m ago
The problem isn't relying on inode numers; it's inode numbers being too short. Make them GUIDs and the problems of uniqueness disappear. As for stability: that's just a matter of filesystem durability in general.
Animats · 1h ago
It's been a long time since what user space sees as an "inode" has anything to do with the representation within the file system.