[NTLUG:Discuss] inodes
Leroy Tennison
leroy_tennison at prodigy.net
Sat Sep 9 21:06:59 CDT 2006
Another interview question dealt with what inodes contain. Google is
leading to confusion. I suspect the reason is inadequate qualification
of statements but I'd rather find out than be mis-informed. Statements
I'm finding:
There is no difference between a file and a directory since the latter
is just a special type of file.
Some references say that inodes describe files
(www.cse.psu.edu/~anand/spring01/linux/files.ppt - slide 2 and
http://www.freeos.com/articles/3851/) while one reference
(http://www-rohan.sdsu.edu/doc/debian/ch-advanced.html) says that the
inode contains the file.
A hard link is a pointer to an inode.
A directory is simply a list of filename and inode pairs.
You can not have a hard link to a directory in most UNIXes.
Questions:
If a directory is a file and files are accessed through inodes and users
access inodes through hard links then how does a user access a
directory if it doesn't have a hard link in another directory? Should
the statement about most UNIXes not allowing hard links to directories
really say that they don't allow more than one hard link to a directory
or is there some other answer?
Is the most accurate description of an inode that it contains both
information about a file (or directory) such as ownership and
permissions as well as pointers to it's data blocks and, as a result,
is the only mechanism for accessing those data blocks as a file? (I'm
excluding the concept of accessing the data blocks as raw storage by
lower-level functions doing disk maintenance).
Thanks for helping me understand.
More information about the Discuss
mailing list