Red HatThis forum is for the discussion of Red Hat Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
a question about inode strangled me today (in fact entire day),though i used to think i know inode very well.The que was
if the inode doesnt conatin filename where is filename actually stored?
where is filename to inode mapping occurs?
i guess i did enough search to make my self confused over this topic.
guys bail me out of this issue
any resource to look for will also be very very helpful.
Thanks and regards
As far as my understanding goes inode is index node which every file/directory gets when you create a new file/directory in Linux. You can refer to the following link as to what inode contains:
if the inode doesnt conatin filename where is filename actually stored?
When you create a file the filename actually get stored on the disk and once create it, it gets the inode number which makes the OS to index the file. You can refer following link for the same:
thats very informative T3RM1NVT0R,
but still i have this issue:
we have a inode tables pointing to data location and file name points to inode number in inode table,but where the filename to inode no mapping is stored.
a file a.txt is assigned a inode of 1000, when we access file a.txt, kernel actually access inode 100,but how does the kernel gets the mapping info of a.txt to inode 100,where its stored?
Well I am bit confused here, you say that when you access a file with inode 1000 kernel actually accesses a file having indoe 100. How did you find that?
File names are stored on the disks and inodes are given to them then how they can differ when you are accessing the file. Please let me know what exactly you are trying so that I can understand and will be able to give you more info on that.
"Given a name, the data in the directory will tell you the inode number that corresponds to that name, and that is all. To read the data that corresponds to that name, Unix still has to look in the file system to find the inode (by number), and then use the disk block numbers contained in the inode to locate the data."
in a nutshell,if a if a inode doesnt include a filename ,where in file system,the file name (lets say a.txt) is stored? if its stored at a place, say "X" ,how the kernel maps or knows the inode no of file a.txt?
there should be something like
NAME inode_no
a.txt 1000
b.sh 1001
now the kernel ,seeing access request for a.txt, would go to inode 1001 and fetch the file.
Is there any kind of "name-to-inode" mapping exist?
take me as a noob bro,thanks for helping me this far.could you further explain/comment on above
The name to inode mapping is in the directories which are themselves files (on UNIX and now Linux "everything is a file"). There's a diagram here; a C struct declaration of the "dirent" shown there is shown in many places including the readdir man page.
Last edited by catkin; 05-22-2011 at 01:13 AM.
Reason: removed earlier post with spelling mistake
catkin,I guess you have the answer i am looking for.plz explain it just a llttle more
Sure. Which part don't you understand? Do you know C? This low level stuff is written in C so is relatively easy for C programmers to understand -- and relatively obscure if you have no knowledge of C.
Last edited by catkin; 05-22-2011 at 12:12 PM.
Reason: sub-editing tyranny
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.