Introduction to Linux Inodes - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Community

Introduction to Linux Inodes

Share This

Inode is a data structure used in Linux and Unix-like file systems such as ext3, ext4 etc. It contains metadata about the files. It stores attributes and disk block locations of file system objects.

Inodes store information about files and directories. Each file is associated with an Inode, which is nothing but an integer. And a directory contains an enty for parent, for itself and a list of children, which are assigned to Inodes.

When a user wants to access a file, the files are accessed by their names, but internally the file names are mapped with inodes that are stored in a table. The file system driver performs this operation by searching a file in a directory and coverting the file name to respective inode number.

If you want to get inode number of the files, you can run ls -i command.

Inode Contents

Following contents are stored in the Inode:

User ID of file
Group ID of file
Device ID
File size
Date of creation
Permission
Owner of the file
File protection flag
Link counter to determine number of hard links

The ls -ld command will show files and directories information in the present working directory in detail. To know more about ls command, you can check man page.

The Inode table contains all the Inodes and is created when file system is created. If you want to check number of free inodes in your file system, you can run df -i command.

Remember that a Inode doesn't contain content of a file, but it is a pointer to the actual data stored in the file system.


Happy Exploring!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.