The guide to my data: Inode

Do you know where the data is stored and how does is arranged in order to have easy and fast storing and retrieval.🤔

So lets have a scenario, to arrange some student’s sitting arrangement we use some strategy like rows and columns, then we follow the pattern of their enrollment no. but do you think why this is required?🤔

Yeah, the proper organization is very required in order to manage them properly and easily !!

Do you think arranging them properly is enough?🙄 No, its not in order to manage them in an efficient way we must have some information like “Which desk is assigned to whom? What’s the range of students(in each row)….etc!!” 🤷‍♀️

So basically this information for the management of things is known as metadata(Information about data).📄

Now, in order to manage the files/dir in the disk, there is some strategy/system that is called as File system.

e.g., ext3, ext4….etc!!

Now what pattern they follow and how actually a file system works ?🤔

So basically every file system has two parts:- block devices and inode tables.

In this, block devices are fixed like we have added a block device(an EBS volume) to an EC2 instance. In this device we setup the file system whatever is the requirement(say ext4 this time).

**Next comes to the inode table.

Before moving to inode table we need to understand the concept of inodes and how they used in File system?🧠

Have you seen the content page/ index page of any of your book ….❓

With the index page of a book, we used to look for the page number as per the chapter/topic names! And we try to access the chapter/topic through this page number.

The concept of inode is similar to the concept of index page…how? Lets work on this!!

Now as we have unique page numbers for a particular chapter or topic…..similar to that when a file/dir(set of files) is created in the system(say linux in my case) a unique number is assigned to it….this number is called as inode number.

*One more thing !!!!

Inode table is similar to index table…..mark my works ,…..its not same…

How ❓

First, mark what are the details a inode table consist about a file: it contains ..

Inode number, owner info, permissions…size etc.

Now does it contain the file name as well? The answer is no!

The name is stored in different table and inode number in different — -à map to the inode table means two different tables are mapped to track each file through inode number.

To get the inode numbers associated with each file, we use:

List of all the inode numbers..

Lets see what happen when we create a new file🤔

Inode is the entry point or we can say the initial block where we create a file.

Note:- Have you tried to create multiple files with same name ? or we can say same files at different location? Does they have same inode number ? is it really possible??🤯

The answer is yes😁….but only if they belong to different partitions. What does that means, first lets have two different partitions of a block device!

The inode number for this directory is already created, when we created the directory.

Lets try to read the inode table, for this we need to use the filesystem that have ext4 format type

For this lets create a different block device if not available ….else create a partition in it

I have attached a new one

Now to create a partition in this new device, open this block device

Successfully created a partition, lets check whether it has the inode table now?🤔

No it won’t be, for that first we have to mount this on some directory!! But before that it need to be formatted to some file system

Now just mount it to the directory

Lets check the inode status for each file system

Here we tried to get the information in the file system about the file abcd.txt,🤔 it will provide all the information regarding the inode number along with the access control etc.

We have used debugfs command to debug the file system /dev/sdb1

Here the link value is 3 for the directory ‘ . ‘ because Each directory contains entries for “.” and “..” — — the current directory and its parent.

The same inode number of ‘.’ And /test_env are pointing to the same node ……..as ‘.’ Represent the current directory.😌

This is how we can have deep information about the inode tables, by debugging into the file system.🤩

You wanna know how the data is being transferred between RAM and main memory❓ Then …….stay tuned!!😄

🌟Keep Sharing, Keep Learning!! 🌟

I am a tech enthusiast, researcher and work for integrations. I love to explore and learn about the new technologies and their right concepts from its core.