Penguin

Differences between current version and revision by previous author of Inode.

Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History

Newer page: version 14 Last edited on Wednesday, January 28, 2009 10:26:48 am by AristotlePagaltzis
Older page: version 12 Last edited on Monday, June 4, 2007 2:01:36 pm by BenStaz Revert
@@ -1,42 +1,24 @@
-An inode stores basic information about a regular file, directory, or other file system object. It contains a list of direct, indirect, and doubly and triply indirect pointers. On some FileSystems, very small files can be stored directly in the [Inode] itself. 
+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
  
-The inode number is a unique integer assigned to the device upon which it is stored . All files are hard links to inodes. Whenever a program refers to a file by name, the system conceptually uses the filename to search for the corresponding inode
+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
  
-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 sufficient HDD space exists.  
+!! Relation to filenames  
  
-!!How many Inodes do I have free?  
+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.  
  
-*df - i  
+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.  
  
-!!What information does an [Inode] store?  
+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.  
  
-Note : Inodes do NOT contain filenames.  
+!! Standard [Unix] timestamps  
  
-* The size of the file in bytes .  
-* The file's physical location (the addresses of the blocks of storage containing the file's data on a HDD)  
-* The file's permissions.  
-* The Device ID  
-* The User ID of the file's owner.  
-* The Group ID of the file.  
-* Timestamps (ctime,mtime and atime). See [FileTimes]  
-* A reference count telling how many hard links point to the [Inode]
+<b>atime</b>:  
+ Time of last access . Updated on every access to the file unless the FileSystem was mounted <tt>readonly</tt> or <tt>noatime</tt>
  
-!!View Inode Information for a particular file. 
+<b>mtime</b>:  
+ 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
  
-For example [PhilMurray's|PhilMurray] famous macaroni and cheese recipe
+<b>ctime</b> :  
+ Time of last inode modification. Updated for any changes to permissions, ownership, link counts, file size, etc.  
  
-<verbatim >  
-$stat macaroni_and_cheese  
-  
- File: `macaroni_and_cheese'  
- Size: 1965 Blocks: 8 IO Block: 4096 regular file  
-Device: 305h/773d Inode: 2775423 Links: 1  
-Access: (0644 /-rw -r--r--) Uid: ( 1000 / staz) Gid: ( 1000/ staz )  
-Access: 2007 -05 -16 00:21:17.000000000 +1200  
-Modify: 2007 -05-16 00:21:16.000000000 +1200  
-Change: 2007-05-16 00:21:16.000000000 +1200  
- </verbatim>  
-  
-!!How to obtain a file's [Inode] number  
-  
-*ls -i <file
+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.