1832181 Members
2921 Online
110038 Solutions
New Discussion

Re: Same inode numbers?

 
SOLVED
Go to solution
Prasad Joshi
Regular Advisor

Same inode numbers?

Hi All,

I am printing the inode numbers of directories which are mounted under /mnt/

bash-2.02# ls -i /mnt/
136712 vol 2 vset1 2 vset2 2 vset3 2 vset4

As can be seen all vset1 to vset4 have same inode numbers.

Can any one explain?

Thanks a lot.
Prasad
7 REPLIES 7
Warren_9
Honored Contributor

Re: Same inode numbers?

hi,

it can happen if the file are hard link.

# cd /test
# touch hehe
# ln hehe haha
# ls -i
21 ren 21 war

GOOD LUCK!!
Arunvijai_4
Honored Contributor

Re: Same inode numbers?

Hi Prasad,

It happens only when you have hard links on /mnt. Check ll /mnt to find it out.

Also, take a look at http://en.wikipedia.org/wiki/Inode for a detailed explanation about inode.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Senthil Kumar .A_1
Honored Contributor
Solution

Re: Same inode numbers?

Hi Prasad,

In the following case, it is a special case not a hard link per say. If you notice though the inodes are identical , the value is 2. It means, it is a directory on which a filesystem is mounted. Thats because the root inode of any filesystem is "2". If you unmount the filesystems on these vset* directories and run the same command again, you will notice that the inodes will not be identical anymore.

To know more about this internal concept I recommend you to go through a book titled...

The design of the UNIX operating system - Maurice J. Bach

regards,
Senthil Kumar .A
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Prasad Joshi
Regular Advisor

Re: Same inode numbers?

Those are not surely hard links.
As you can see from this output

bash-2.02# ls -li
total 8
136712 drwxr-xr-x 2 root root 96 Apr 27 17:28 vol
2 drwxrwxrwx 6 root root 1024 May 3 13:23 vset1
2 drwxrwxrwx 5 root root 1024 Apr 27 17:34 vset2
2 drwxrwxrwx 5 root root 1024 Apr 27 17:34 vset3
2 drwxrwxrwx 5 root root 1024 Apr 27 17:34 vset4
Senthil Kumar .A_1
Honored Contributor

Re: Same inode numbers?

Hi,

Just for confirmation, can you see the output of the command, "bdf" or "df -k" and see whether thay are mountpoints or not ?

Regards,
Senthil Kumar .A
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Prasad Joshi
Regular Advisor

Re: Same inode numbers?

Ya they are mount points only.

I checked with the BACH. It is a valid behavior.

Thanks a lot for your help.
Andrew Merritt_2
Honored Contributor

Re: Same inode numbers?

Just to make one point clear, as I don't see it stated above, inode numbers are only unique within a file system. As there are several filesystems mounted in the same directory that's why the inode number can be duplicated, and it's part of the design that the root inode has the value 2.

Andrew