Files, Inodes, and Blocks
I'd like to thank everyone for their help and patience so far, and for their continued help and patience in the future. Being a newbie filesystem developer, I probably seem like the nagging kid that asks a thousand questions.
I want to make sure I understand this right.
There is a 1:1 relationship between the number of files and the number of used inodes. In other words, each file has only one corresponding inode.
There is a 1:many relationship between the number of used inodes (1) and the number of used blocks (many). In other words, one inode can refer to many blocks.
Am I right?
TIA.
Joseph Wagner
Quoted 6 lines · Joseph D. Wagner
There is a 1:1 relationship between the number of files and the number of used inodes. In other words, each file has only one corresponding inode.
There is a 1:many relationship between the number of used inodes (1) and the number of used blocks (many). In other words, one inode can refer to many blocks.
Assuming you're talking about a "classic" Unix filesystem like ext2, yes. I think you probably need to read some of the classic texts on Unix filesystems. Many libraries have this available:
Leffler, Samuel J., Marshall Kirk McKusick, Michael J. Karels, and John S. Quarterman, The Design and Implementation of the 4.3BSD UNIX Operating System, Addison-Wesley, Reading, MA, 1989. $40 ISBN 0-201-06196-1.
which was how I learned about how Unix filesystems work. I'm sure there are other good books.
FWIW, in BSD's FFS and several other filesystems (not ext2 though), there are ways for multiple files to share the same block (fragments or tail-packing), so blocks <-> files can be many-to-many.
The other thing that tends to confuse people new to Unix filesystems is that an inode is a file, but files can have 0-or-more names. That is, a file will continue to exist as long as there is a reference to it, where a reference can be an open file handle or a directory entry. And multiple directory entries can refer to the same file (see ln(1)).
Signature · 3 lines
"It's not Hollywood. War is real, war is primarily not about defeat or victory, it is about death. I've seen thousands and thousands of dead bodies. Do you think I want to have an academic debate on this subject?" -- Robert Fisk
Thanks. Per your advice I got:
Pate, Steve D. UNIX Filesystems: Evolution, Design, and Implementation. Wiley: Indianapolis, Indiana. 2003. ISBN: 0-471-16483-6 US$45.00
http://www.amazon.com/exec/obidos/tg/detail/-/0471164836/
Based upon the table of contents, it should answer 99.999% of my questions and keep me occupied for a very long time.
Joseph Wagner
Quoted 46 lines
-----Original Message-----
From: Matthew Wilcox [mailto:[email protected]]
Sent: Saturday, October 04, 2003 2:40 PM
To: Joseph D. Wagner
Cc: [email protected]
Subject: Re: Files, Inodes, and BlocksQuoted 1 line · Joseph D. Wagner
There is a 1:1 relationship between the number of files and the number
of
Quoted 1 line
used inodes. In other words, each file has only one corresponding
inode.
Quoted 2 lines
There is a 1:many relationship between the number of used inodes (1) and
the
Quoted 1 line
number of used blocks (many). In other words, one inode can refer to
many
Quoted 1 line
blocks.
Assuming you're talking about a "classic" Unix filesystem like ext2, yes. I think you probably need to read some of the classic texts on Unix filesystems. Many libraries have this available:
Leffler, Samuel J., Marshall Kirk McKusick, Michael J. Karels, and John S. Quarterman, The Design and Implementation of the 4.3BSD UNIX Operating System, Addison-Wesley, Reading, MA, 1989. $40 ISBN 0-201-06196-1.
which was how I learned about how Unix filesystems work. I'm sure there are other good books.
FWIW, in BSD's FFS and several other filesystems (not ext2 though), there are ways for multiple files to share the same block (fragments or tail-packing), so blocks <-> files can be many-to-many.
The other thing that tends to confuse people new to Unix filesystems is that an inode is a file, but files can have 0-or-more names. That is, a file will continue to exist as long as there is a reference to it, where a reference can be an open file handle or a directory entry. And multiple directory entries can refer to the same file (see ln(1)).
--
"It's not Hollywood. War is real, war is primarily not about defeat or victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk