I know that the filename is stored in directories and not in inode. Kindly tell me where the inode number of a file is stored? Is it stored in the directory file?

link|improve this question

25% accept rate
feedback

2 Answers

up vote 2 down vote accepted

Yes, directory entries contain the filenames and their inodes.

link|improve this answer
Thanks jlliagre. So when I give ls -il, the inode numbers are listed from the directory file right? – LinuxPenseur Dec 15 '10 at 8:18
Indeed, that's where they live. – jlliagre Dec 15 '10 at 9:17
Thanks, Only when i give ls -l can i see the inode number. Since directory is also a file, is there any way to see the contents of directory which will list the inode numbers also – LinuxPenseur Dec 15 '10 at 10:24
Your statement "a directory is also a file" is dubious. A directory is a directory, not a regular file. Depending on the operation system and the filesystem used, you might or might not be able to see the raw content of the directory. You can try "od -c directory". – jlliagre Dec 15 '10 at 10:37
@jlliagre, I am sorry, but i will have to disagree with you on your comment on ""a directory is also a file" is dubious". As far as my knowledge goes Directories: files that are lists of other files. So i guess Directory is also a file – LinuxPenseur Dec 15 '10 at 10:51
show 2 more comments
feedback

According to me, INODE will also use a very tiny portion of disk space (1 or 2 sectors), depends on the size of a file information it holds. In Linux, Inodes will be created when we create the filesystem itself. During that time, a small portion of disk space will be taken for Inodes.

link|improve this answer
"In Linux, Inodes will be created when we create the filesystem itself." - that depends on the filesystem. The traditional ext[234] filesystems do have fixed inode table, but for example ReiserFS and XFS has dynamic inodes. – Janne Pikkarainen Jul 25 '11 at 10:32
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.