What is inode

An inode is an entry in inode table that contains information about a file and directory. It is a is a data structure on a traditional Unix-style file system such as ext3 or ext4, xfs. Each file has a inode on Unix system. Refer to the solution section for more information.


Topic

  • What is an indode?
  • What is an inode in Linux?
  • What is an inode number?
  • Where are file/directory names are stored?
  • What are the information an inode contains?


Solution


inode consists of the following information:
  • File types ( executable, block, socket, device, pipe, etc )
  • Permissions ( read, write, execute)
  • UID ( Owner )
  • GID ( Group )
  • FileSize
  • Time stamps including last access, last modification and last inode number change.
  • File deletion time
  • Number of links ( soft/hard )
  • file location on disk.
  • Other metadata about file.

Where are the file/directory names are stored?

inodes do not contain file names but contains other file metadata. Each file in Unix contains one filename and one inode number. The file system driver searches a directory looking for a particular filename and then converts the filename to the correct corresponding inode number.

inode Diagram


How to check inode number of a file in Linux?
$ ls -li file1.txt 
67197455 -rw-rw-r-- 1 user1 user1 14 Sep  6 00:37 file1.txt

$ stat file1.txt 

File: ‘file1.txt’
  Size: 14          Blocks: 8          IO Block: 4096   regular file
Device: fd05h/64773d    Inode: 67197455    Links: 1
Access: (0664/-rw-rw-r--)  Uid: (1001/  user1)   Gid: (1001/  user1)
Access: 2019-09-06 00:37:06.168758045 +0530
Modify: 2019-09-06 00:37:06.168758045 +0530
Change: 2019-09-06 00:37:06.168758045 +0530
 Birth: -


You May Also Like

avatar

About the Author: TekFik

TekFik is a technical blogging site helps techies and engineers to solve their day to day issues and also allows everyone to share knowledge and feedback. Please feel free to contact us at tekfik.rd@gmail.com if there is anything.

Leave a Reply

Your email address will not be published. Required fields are marked *