What is Inode in linux/unix ? - cyber thieve

 Inode In linux

Inode is a uniquely defined number for all the files in Linux and all Unix type filesystems.

Inode is a data structure that keeps track of all the files and directories. So every file and directory in a filesystem is allocated an inode, which is identified by an integer.

Inode store metadata(times of last change, access, modification), as well as owner and permission data about each file and directory.

When a file is created on a system, a file name and Inode number is assigned to it.Generally, to access a file, a user uses the file name but internally file name is first mapped with respective Inode number stored in a table.

A directory is a list of inodes with their assigned names. The list includes an entry for itself, its parent, and each of its children.

Note : Inode is a short abbreviation of Index Node

Inode In linux


Also Read Our Other Post On Linux Basics

How To Install Kali Linux
How To Clear Bash History


Inode Table

The Inode table contains all the Inodes and is created when file system is created. The df -i command can be used to check how many inodes are free and left unused in the filesystem.

Inode Number


Each Inode has a unique number and Inode number can be seen with the help of ls -li command.

Inode contains :

Inode is a data structure containing metadata about the files.

  • File owner identifier
  • File type
  • File access permission
  • File access times
  • Number of links to the file
  • Table of contents for the disk addresses of data in a file
  • File size


  • File owner identifier Ownership is divided between an individual owner and a "group" owner and defines the set of users who have access rights to a file. The superuser has access rights to all files in the system. 
  • File type Files may be of type regular, directory, character or block special, or FIFO (pipes).
  • File access permissions The system protects files according to three classes: the owner and the group owner of the file, and other users; each class has access rights to read, write and execute the file, which can be set individually. Because directories cannot be executed, execution permission for a directory gives the right to search the directory for a file name. 
  • File access times giving the time the file was last modified, when it was last accessed, and when themode was last modified. 62 INTERNAL REPRESENTATION OF FILES 
  • Number of links to the file representing the number of names the file has in the directory hierarchy. Chapter 5 explains file links in detail. 
  • Table of contents for the disk addresses of data in a file. Although users treat the data in a file as a logical stream of bytes, the kernel saves the data in discontiguous disk blocks. Themodeidentifies the disk blocks that contain the file's data. 
  • File size Data in a file is addressable by the number of bytes from the beginning of the file, starting from byte offset 0, and the file size is 1 greater than the highest byte offset of data in the file. For example, if a user creates a file and writes only 1 byte of data at byte offset 1000 in the file, the size of the file is 1001 bytes. 



Conclusion

Inode are not something you interact directly with, but they play an important role. If a partition is to contain many very small files, like a mail server, knowing what they are and how they work can save you a lot of problems down the road.
I hope you liked this article and learned something new and important about inode in Linux. Subscribe to our website to learn more Linux-related information.




Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Ok, Go it!