Open In App

Inode in Operating System

Last Updated : 28 Jan, 2024
Like Article

In Unix based operating system each file is indexed by an Inode. Inode are special disk blocks they are created when the file system is created. The number of Inode limits the total number of files/directories that can be stored in the file system. 

An Inode is a data structure in UNIX operating system that contains important information pertaining to files within a file system. When a file system is created in UNIX, a set amount of indoes is created as well. Usually, about 1 percent of the file system disk space is allocated to the inode table.

The Inode contains the following information: 

14 Bytes            

2 Bytes

File name 1

i-node 1

File name 2

i-node 2

Directory name 1

i-node 3

  1. Numeric UID of the owner.
  2. Numeric GUID of the owner.
  3. Size of the file.
  4. File type: regular,directory,device etc…
  5. Date and Time of Last modification of the file data.
  6. Date and Time of Last access of file data.
  7. Date and Time of Last change of the I-node.
  • Administrative information (permissions, timestamps, etc).
  • A number of direct blocks (typically 12) that contains the first 12 blocks of the files.
  • A single indirect pointer that points to a disk block which in turn is used as an index block, if the file is too big to be indexed entirely by the direct blocks.
  • A double indirect pointer that points to a disk block which is a collection of pointers to disk blocks which are index blocks, used if the file is too big to beindexed by the direct and single indirect blocks.
  • A triple indirect pointer that points to an index block of index blocks of index blocks.

Inode Total Size: 

  • Number of disk block address possible to store in 1 disk block = (Disk Block Size / Disk Block Address).
  • Small files need only direct blocks, so there is little waste in space or extra disk reads in those cases. Medium-sized files may use indirect blocks. Only large files use double or triple indirect blocks, which is reasonable since those files are large anyway. The disk is now broken into two different types of blocks: Inode and Data Blocks.
  • There must be some way to determine where the Inodes are, and to keep track of free Inodes and disk blocks. This is done by a Superblock. Superblock is located at a fixed position in the file system. The Superblock is usually replicated on the disk to avoid catastrophic failure in case of corruption of the main Superblock.
  • Index allocation schemes suffer from some of the same performance problems. As does linked allocation. For example, the index blocks can be cached in memory, but the data blocks may be spread all over a partition.

Inode Structure :


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads