How does Linux Inode work?
If you use Linux long enough, you will know the term 'inode'. It does appear occasionally, but does not affect what you are doing. The following article will explain what an inode is and how it works.
What is inode?
In a library, all books are sorted by genre, author name or audience age. Like a library, all files in the Linux system are organized for efficient retrieval and use. Inode is an entity that supports file organization in Linux systems.
What is file metadata?
Suppose we have a file named 'sample.txt' containing the data 'hello'.
This file has some data and related information such as file size, permissions, group and user ownership, timestamp created / accessed / modified, number of links, etc. All of this information is collectively referred to as file metadata.

What is the file system?
Refer to the article: Basic File System in Unix / Linux for more details.
Combining concepts together
Inode is a data structure on Ext4 that contains all the metadata for a file.
Of course there will be many files on a file system. As you can guess, each file has its own inode and each inode is numbered.
Inode numbering like?
The number of inodes on a file system starts from the first 1.10 inodes are reserved for system usage. User files have metadata stored from inode 11. All inodes are neatly stacked in an inode table.
An entry in the inode table will have a capacity of 256 bytes. For one file, Linux intelligently sorts all the metadata within this 256-byte range! In addition, each inode for a file will have information about the location of the data in the file system. Remember, only the metadata of the file is stored in the inode.
The total number of inodes in a file system depends on the available space and the number of files that can be stored on the partition.
How are inodes allocated and freed?
When users add files to the newly formatted file system, inodes starting at 11 are allocated to hold file metadata.
There is another data structure called Inode Bitmap , used to track the allocation status of an inode. It is a set of bits that act as a map.
Consider the 8 bits in the inode bitmap to indicate the allocation status of 11 to 18 inodes as shown in the table below. A value of 1 in the bitmap means that the inode has been allocated to hold metadata for a file. A value of 0 in the bitmap means that the inode is currently not in use. Here, you can see that inode 17 is being used.

In the case of a file whose metadata in inode 17 is deleted, its corresponding bitmap status becomes 0 , indicating that it can be freely used by another file.

How to view the inode number for a file?
There are two ways to do this.
The first is to use the ls
command with switch -i, followed by the name of the file. The first field in the output is the inode number that has metadata of sample.txt.
The same information can be obtained by stat
command followed by the file name.

To see the total number of inodes available for a partition, the df command can be used with the -i switch .
In the '/ dev / sda4' partition, 404854480 inode is available for use, of which only 359044 inode is used.
Inode, inode tables organize metadata of all files meticulously in inodes, along with information about the location of the file data. Note all that the article discussed about Linux inode is just the tip of the iceberg.
You should read it
- Compare the most popular Linux distributions today
- 7 best Linux distributions based on Red Hat
- 5 Linux Lite tips for Windows users
- Basic Linux commands everyone needs to know
- How to downgrade kernel in Linux
- What's new in Linux Kernel 5.18?
- 6 reasons why the Linux operating system often fails
- 8 best Linux distros for pentest
May be interested
- Bring the best of Linux to Windows with CASHwindows command prompt is like an annoying mess, rather than an indispensable part of the operating system. in contrast, linux is designed to be very elegant, while helping users easily work efficiently.
- 4 reasons why white hat hackers love to use Kali Linuxthis operating system has many different features and tools, but there is always controversy as to why hackers use kali linux for work related to network security.
- How to check the pressure of a Linux systemtesting pressure on linux servers is a good idea if you want to see if they work well. in this post, tipsmake introduces some tools that can help you add pressure to the system to test and evaluate results.
- Steps to install Webex for Linuxwebex is now available for linux. linux communities and users can use webex to bring you live messaging, meetings, and calling in work and education environments.
- 18 Interesting Linux Commands in Terminalterminal is a very powerful tool, but it can be made 'interesting' through a few bash commands that tipsmake.com will introduce to you below. let's follow and learn because some commands are quite useful.
- Guide to network operation for Linux users: 11 commands to knowlinux supports commands to download files, diagnose network problems, manage network interfaces or view network statistics on the terminal. here are some common linux commands to work with, please consult.
- Making Linux look like macOS with these easy tweaks!you can learn the simple steps needed to make the linux desktop work and look like apple's macos.
- Kali Linux commands from AZ and commonly used commandscombining kali linux commands from az comes with some commonly used kali linux commands that make it easy to work with this operating system.
- How to use DNS over TLS on Ubuntu Linuxyou can use dns in which all dns queries are processed through the encrypted tls (transport layer secure) protocol. however, most operating systems do not work with dns over tls.
- 20+ essential Linux security commandshere are some of the most important security commands for everyday work on linux systems. if you're interested in security issues on your linux system, don't ignore these helpful security commands.