(Debian 10.5, kernel 4.19.132-1 )
My understanding is that inodes are unique on a given filesystem, and indeed if we look at man inode
we get the following assertion:
Each file in a filesystem has a unique inode number.
But I do not appear to be seeing this in practice.
I have a /tmp
filesystem defined as follows in fstab
:
/dev/mapper/foo-lv_tmp /tmp xfs nodev 0 0
But if I experiment with mktemp
I get the same inode:
$ mktemp
/tmp/tmp.BovySvY5Fw
$ echo 'foo'> /tmp/tmp.BovySvY5Fw
$ ls -i /tmp/tmp.BovySvY5Fw
135 /tmp/tmp.BovySvY5Fw
$ rm /tmp/tmp.BovySvY5Fw
$ mktemp
/tmp/tmp.UzUQZROBoo
$ echo 'foo'> /tmp/tmp.UzUQZROBoo
$ ls -i /tmp/tmp.UzUQZROBoo
135 /tmp/tmp.UzUQZROBoo
$ rm /tmp/tmp.UzUQZROBoo
I also see the same behaviour outside of /tmp
e.g. my home dir:
foo@bar:~$ echo 'a' > foo
foo@bar:~$ ls -i foo
67135721 foo
foo@bar:~$ rm foo
foo@bar:~$ echo 'a' > foo
foo@bar:~$ ls -i foo
67135721 foo
foo@bar:~$ rm foo