Software Tech

Linux – INODE

Remember how our filesystem is comprised of all our actual files and a database that manages these files? The

Linux – INODE

Remember how our filesystem is comprised of all our actual and that manages these files?

The database is known as the inode table.

What is an inode?

An inode (index ) is an entry in table and there is one for every file.

describes everything about the file, such as:

File type – regular file, , character device, etc
Owner

Access permissions
Timestamps – mtime ( of last file modification), ctime (time of last change), atime (time of last access)
Number of hardlinks to the file
Size of the file
Number of blocks allocated to the file
Pointers to the data blocks of the file – most important!

Inodes store everything about the file, except the filename and the file itself!

How do inodes locate files?

We know our data is out there the disk somewhere, unfortunately, it probably wasn't stored sequentially, so we have to use inodes.

Inodes point to the actual data blocks of your files.

In a typical filesystem (not all the same), each inode contains 15 pointers, and the first 12 pointers point directly to the data blocks. The 13th pointer points to a block containing pointers to more blocks, the 14th pointer points to another nested block of pointers, and the 15th pointer points yet again to another block of pointers!

Confusing, I know!

The reason this is done this way is to keep the inode structure the same for every inode but able to files of different sizes. If you had a small file, you could find it quicker with the first 12 direct pointers, larger files can be found with the nests of pointers.

Either way, the structure of the inode is the same

If the article helps you, leave a like, follow, or anything 🙂.

You can follow on LinkedIn and GitHub.

About Author

Abhishek Pathak

Leave a Reply

SOFAIO BLOG We would like to show you notifications for the latest news and updates.
Dismiss
Allow Notifications