Skip to content
Welcome To Charanjit Cheema Blog

Welcome To Charanjit Cheema Blog

An Open Source and Cloud Blog

Menu
  • Home
  • About Me!
  • Way to my Technical Blog
  • Contact me
  • Privacy Policy
Menu

Understanding of Linux Inodes

Posted on November 15, 2019 by Charanjit Cheema

Introduction to Inode

File descriptors, file table and inode table in Linux. Image Source: Wikipedia

An inode is a data structure on a filesystem on Linux and other Unix-likeoperating systems that stores all the information about a file except its name and its actual data.

Inode is created during creation of file along with file name, inode is an integer value which is always be unique for different files in Linux filesystem. File name and corresponding inodes are stored as entry in directory.

When any program or user call the file for performing operation the Linux operating system lookup the inodes with corresponding to that file name in filesystem as for Linux Operating System files are only identified by inode number which are stored in inode table. These inode tables stores as systematically in filesystem mostly in beginning of it.

These inode tables are very important as it not only stores inodes number it store inodes itself as well. Loosing of inodes mean you can loose you files even it can make whole filesystem unrecoverable from damage thus avoiding such situation Linux store the lost inodes in lost+found directory of same filesystem (example in case of ext3/ext4 filesystem) where the damage files inode resides:

You might have seen whenever you run e2fsck command it first of all try to recover inodes when it get inodes information it start repairing files and filesystem further.

What information inode contains?

Inode contain below information:

  • File type (executable, block special etc)
  • Permissions (read, write etc)
  • Owner
  • Group
  • File Size
  • File access, change and modification time
  • File deletion time
  • Number of links (soft/hard)
  • Access Control List (ACLs)

Hard Link concept

A hard link is an entry in a directory that contains a pointer directly to the inode bearing the file’s metadata. When a new hard link to a file is created, both links share the same inode number because the link is only a pointer, not a copy of the file.

Example of hard link file inode, you can see in below screenshot both files test1.txt and test2.txt (hardlink file) have same inode number:

How to check inodes of files and mounted filesystem?

Below command can show you inode number of files in filsystem:

# ls -i <filename> 

or

# stat <filename>

Example:

You can get mounted filesystem inodes usage from below command:

# df -i 

also you can use below more extended df command for getting human readable format of inode usage.

# df -ih 

Example in below screenshot I have captured mounted /boot mount point inode usage:

 

How to troubleshoot full inode issue?

Sometime you have deleted files but it is still holded by running process example a Linux server running Oracle DB process. Below is the solution to get rid of holded deleted files for freeing inodes.

Find out the process and file descriptor(fd) id of deleted files from below command:

# /usr/sbin/lsof | grep deleted

ora 25575 data 33u REG 65,65 4294983680 31014933 /oradata/DATAPRE/file.dbf (deleted) 

Now use file command to check type of files holded by process

# file /proc/25575/fd/33 

/proc/25575/fd/33: broken symbolic link to `/oradata/DATAPRE/file.dbf (deleted)'

Trunk the deleted file fd with echo command for releasing it from hold of process.

# echo > /proc/25575/fd/33

 

Deleting special character filename with help of inode number

Special character filenames are difficult to delete from normal remove command: rm . 

Below is the solution for removing special character files with the help of their inode number:

  • Identify the inode number of file.

  • Now use below find command for removing file with  identified inode number.

 

 

Loading

  • Author
  • Recent Posts
Charanjit Cheema
Follow him
Charanjit Cheema
Charanjit is currently working as a Cloud Architect at Mphasis, with 17 years of experience in IT infrastructure projects, implementation, and support. While his main role is as a DevOps engineer, he holds a Cloud Architect position and has strong skills in cloud technologies and automation. His expertise includes Terraform, Ansible, AWS, Azure DevOps, Azure Cloud, VMware, and Linux systems.

Charanjit is passionate about automating tasks and improving processes. He uses tools like Terraform and Azure DevOps to build and manage cloud infrastructure and streamline deployment. He also enjoys using Shell scripts and Ansible playbooks to make systems run more efficiently.

In his free time, Charanjit enjoys learning about new technologies and sharing his knowledge through his blog. When he’s not working, he likes listening to music, having a cup of coffee, and relaxing in nature.

You can connect with Charanjit on Twitter, Facebook, LinkedIn, or email him at charanjit.cheema@cjcheema.com.
Charanjit Cheema
Follow him
Latest posts by Charanjit Cheema (see all)
  • How to optimize the performance of Ansible Automation Platform or Ansible Tower - July 16, 2023
  • How to fix code and text file linting errors with the help of Visual Studio Code - June 27, 2023
  • How to migrate existing WordPress blog from AWS EC2 instance to Amazon Lightsail - May 29, 2023

Like this:

Like Loading...

Related

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Tags

AWS Cloud Computing Dockers Networking Open Networking OpenSource RHEL-CentOS SDN Server Hardware SLES tcpdump Ubuntu WSL

Follow me @

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 2 other subscribers

Recent Posts

  • How to Deploy Docker Containers with NGINX on AWS EC2 Using Ansible and GitHub Actions
  • No More DynamoDB! Use Native S3 locking for Terraform State
  • How to Bring and Manage Manually Created AWS Resources Under Terraform Management
  • Iterating Cloud Resource Provisioning Using Terraform Count and For_Each Meta-Arguments
  • Terraform and Ansible Collaboration for AWS Cloud Deployment

Recent Comments

  1. Charanjit Singh on Terraform and Ansible Collaboration for AWS Cloud Deployment
  2. christinatodd2020aeaa798563 on Terraform and Ansible Collaboration for AWS Cloud Deployment
  3. Charanjit Singh on How to Set password policy in CentOS or RHEL system
  4. SAURABH on How to recover or rebuild initramfs in CentOS 7 Linux
  5. Sangita on How to Set password policy in CentOS or RHEL system

Archives

  • April 2025
  • February 2025
  • January 2025
  • August 2024
  • July 2024
  • June 2024
  • January 2024
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • September 2022
  • August 2022
  • July 2020
  • May 2020
  • February 2020
  • November 2019
  • June 2019
  • May 2019
  • March 2019
  • February 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • June 2018
  • May 2018
  • April 2018

Categories

  • Automation
  • Cloud Computing
  • Coding
  • CyberSecurity
  • Networking
  • OpenSource
  • RHEL-CentOS
  • Server Hardware
  • SLES
  • Technical Blog
  • Ubuntu
  • WSL

Blog Stats

  • 18,353 hits
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Home
  • About Me!
  • Way to my Technical Blog
  • Contact me
  • Privacy Policy
© 2025 Welcome To Charanjit Cheema Blog | Powered by Superbs Personal Blog theme
 

Loading Comments...
 

    %d