LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 05-21-2011, 11:33 AM   #1
aceone
Member
 
Registered: Apr 2009
Posts: 55

Rep: Reputation: 15
questions abt inode.inode gurus plz have a look


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
 
Old 05-21-2011, 12:02 PM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Reply

Hi there,

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:

http://www.cyberciti.biz/tips/unders...em-inodes.html

http://www.webhostingsecretrevealed....ecrets-inodes/

Quote:
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:

http://www.cyberciti.biz/tips/unders...em-part-i.html
 
Old 05-21-2011, 01:12 PM   #3
aceone
Member
 
Registered: Apr 2009
Posts: 55

Original Poster
Rep: Reputation: 15
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?

am i getting somewhere else ??
 
Old 05-21-2011, 02:44 PM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Hi there,

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.
 
Old 05-22-2011, 12:46 AM   #5
aceone
Member
 
Registered: Apr 2009
Posts: 55

Original Poster
Rep: Reputation: 15
quoting from :http://teaching.idallen.com/cst8129/...nd_inodes.html

"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

regards
 
Old 05-22-2011, 01:11 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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
 
1 members found this post helpful.
Old 05-22-2011, 08:25 AM   #7
aceone
Member
 
Registered: Apr 2009
Posts: 55

Original Poster
Rep: Reputation: 15
catkin,I guess you have the answer i am looking for.plz explain it just a llttle more
 
Old 05-22-2011, 12:11 PM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by aceone View Post
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
inode shwetank.techi Linux - Newbie 3 11-02-2010 05:41 AM
what is inode. shellarchive Red Hat 2 01-01-2008 11:12 PM
inode number questions: can they change & when are they reused? BrianK Linux - General 1 10-16-2007 11:21 PM
inode ahmed gamal Slackware 2 04-02-2006 08:34 AM
Multible newbie questions (pppd, ext2 vs ext3, and random inode read errors) (Slack10 Nicolae Slackware 8 08-28-2004 04:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 11:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration