An inode number is only unique on a single file system. One example you’ll run into quickly is the root inode on ext2/3/4 file systems, which is 2:
$ ls -id / /home
2 / 2 /home
If you run (assuming GNU
find / -printf "%i %p\n" | sort -n | less
on a system with multiple file systems you’ll see many, many duplicate inode numbers (although you need to take the output with a pinch of salt since it will also include hard links).
When you’re looking for a file by inode number, you can use
-xdev option to limit its search to the file system containing the start path, if you have a single start path:
find / -xdev -inum 12582925
will only find files with inode number 12582925 on the root file system. (
-xdev also works with multiple start paths, but then its usefulness is reduced in this particular case.)
It's the combination of inode number and device number (
st_ino in the
%D %i in GNU
-printf) that identifies a file uniquely (on a given system). If two directory entries have the same inode and dev number, they refer to the same file (though possibly through two different mounts of a same file system for bind mounts).
find implementations also have a
-samefile predicate that will find files with the same device and inode number. Most
test implementations also have a
-ef operator to check that two files paths refer to the same file (after symlink resolution though).