, the inode is the central concept of the
, and contains all the interesting file
attributes, all of which can be read by the user
using the stat
or fstat system calls.
The inode also lists other data less interesting to the user
that can't be read with stat, including the location of the first 12 data blocks of the file,
and the first indirect, double indirect, and tripple indirect
blocks. (The first indirect block is a list of the next
BLOCKSIZE/4 blocks, and the first double indirect block
is the list of the next BLOCKSIZE/4 indirect blocks, etc..., assuming 32 bit block numbers.) This pattern of direct and indirect blocks has not really changed since the first unix file system, and limits the maximum file size to (12+BLOCKSIZE/4 + (BLOCKSIZE/4)**2 + (BLOCKSIZE/4)**3) blocks, which is usually much larger than st_size anyway,
so st_size limits the real maximum file size (if the size of your disk doesn't first).
The inode and indirect blocks contain all the metadata and attributes for
the file. (The filename is not part of the file nor an
attribute of the file in unix. Some files don't have names at all.) All files in unix have inodes; if the underlying filesystem does not have inodes, the file will still have one
in memory. (Some unixes call an inode cached in memory a vnode.)
The inode may also contain other unix flavor specific information, such as fragmentation maps, extended attributes, or pointers to extended attributes.