Penguin
Annotated edit history of Inode version 14, including all changes. View license author blame.
Rev Author # Line
14 AristotlePagaltzis 1 An inode stores basic information about a regular file, directory, or other file system object: permissions, ownership information, various timestamps, the size of the file, extended attributes, etc. It also contains a list of direct, indirect, and doubly and triply indirect pointers to the location of the actual file contents on disk. On some FileSystems, very small files can be stored directly in the [Inode] itself. You can use the stat(1) command to view all sorts of inode data about a file.
9 BenStaz 2
13 AristotlePagaltzis 3 Sophisticated FileSystems create [Inode]s on demand, but with most, the number of [Inode]s on a [Partition] has to be decided on during FileSystem creation. It is rare to run out of [Inode]s unless you have an unusual usage profile such as storing a news spool or [Squid] cache. Exhaustion of the inodes will prohibit the creation of additional files even if otherwise sufficient storage capacity exists. To find out how many inodes are available, you can use the "<tt>df -i</tt>" command.
14 AristotlePagaltzis 4
5 !! Relation to filenames
6
7 Filenames are __not__ stored in inodes. Instead, filenames are stored in the contents of directories along with inode numbers. The inode number is an integer that is unique within the FileSystem on which the file is stored. You can use "<tt>ls -i</tt>" to find out the inode number for a file.
8
9 Whenever a program refers to a file by name, the path is resolved to a directory, the filename is looked up in that directory, and the associated inode number is then used to locate the corresponding inode.
10
11 Multiple filenames can link the same inode. Inodes contain a counter that is increased every time a new HardLink to them is created. Deleting a filename decrements this counter; only if the counter falls to zero will the file and its inode actually be deleted. All filenames pointing to an inode are equivalent: all filenames are HardLink~s.
12
13 !! Standard [Unix] timestamps
14
15 <b>atime</b>:
16 Time of last access. Updated on every access to the file unless the FileSystem was mounted <tt>readonly</tt> or <tt>noatime</tt>.
17
18 <b>mtime</b>:
19 Time of last modification. Updated on every write; due to buffer flushing, usually corresponds to the time when a file was last closed after opening for writing.
20
21 <b>ctime</b>:
22 Time of last inode modification. Updated for any changes to permissions, ownership, link counts, file size, etc.
23
24 The ls(1) command will show mtimes with the <tt>-l</tt> switch, which can be modified with <tt>-c</tt> and <tt>-u</tt> switches to show ctime or atime, respectively. To get ls(1) to display timestamps with full precision instead of rounding to minutes, using the <tt>--full-time</tt> switch.