news
Gaming Servers Page Already Available. See Live Demo
Locale Settings
My Hostarina
logo
  • Web Hosting
    Shared Hosting
    Shared Hosting

    For Small to Medium Websites

    Unlimited Hosting
    Unlimited Hosting

    For Blogs, Wordpress, Ecommerce Websites

    Free Website Migration
    1. Buy any web hosting package
    2. Request a site migration from your account
    3. Sit back and let us handle things at a time that suits you
    Get Started

  • Servers
    High Performance VPS
    High Performance VPS

    Your own VPS server to securely run the application with peak performance.

    Cloud VPS Servers
    Cloud VPS Servers

    Your Own Virtual Storage Server for using as Files storage space

    VPS Simple. Fast. Reliable

    When purchasing a VPS, it comes with a list of Operating Systems templates, all Linux based, which can be installed in a couple of clicks, saving you the hassle of doing it yourself.

  • SSL Certificates
    Rapid SSL
    Geo Trust SSL
    Symantec SSL
    Thawte SSL
    Comodo SSL
    Sectigo SSL
    Digicert SSL
    cWatch SSL
    Protect Your Brand

    Trust is everything. And, that's never been more true than in today's world, where there are now over 4 million data breaches per day. So, how do you ensure that your reputation and trustworthiness aren't at risk? Implement proper security protections that users can see and feel. When consumers trust your security, they trust your brand.

    SSL Installation

  • Domains
    My Domains
    My Domains

    Your Domains with us

    Domain Register
    Domain Register

    Find the perfect domain name.

    Domain Whois
    Domain Whois

    Lookup tool to find WHOIS information.

    Domains Prices
    Domains Prices

    Domain Pricing List

    Domain Transfer
    Domain Transfer

    Want to transfer domain to Hostarina?

  • Billing
    Payment Options
    Payment Options

    Our Supported Payment Options

    Affiliates
    Affiliates

    Latest News about our services

  • Support
    Website Migration
    Website Migration

    Buy Web hosting and Request a free website migration

    Announcements
    Announcements

    Latest News about our services

    Knowledgebase
    Knowledgebase

    Knowledgebase Articles to solve your problems

    Network Status
    Network Status

    Our Servers and Services Status information

How To Count Inode Usage In Linux?
Useful : 0
Views : 0


  • How To Count Inode Usage In Linux?
  • Removing frozen email from EXIM (Frozen emails)

This Article written by  Magesh Maruthamuthua at 2daygeek.com

As you know, everything is a file in Linux.

Each and every files (It includes all kind of files) and folders/directory called inode.

Each file or directory adds 1 to the inode count.

In this article, we will show you, how to check inode and its count.

Also, we will tell you, how to count for specific user.

What Is Inode?

The inode stands for index node or index number is a data structure in a Linux file system that stores information about a file and directory.

File systems in general have two parts, those are metadata and actual data.

Each file has an inode containing metadata about the file. Each file in a filesystem has a unique inode number. Inode numbers are guaranteed to be unique only within a filesystem.

You may get the following error when inode is full on the file system. No space left on device or running out of Inodes.

Inode stores the following information about a file.

  • Size of the file.
  • Device ID
  • User ID (UID)
  • Group ID (GID)
  • Information about permissions (read, write, execute, etc)
  • File access privileges (owner, group and others)
  • Time stamps information such as file access, file modification, file deletion and inode number change.
  • Information about soft links and hard links
  • Location of the file on the file system

How To Check Inode Number Of The File In Linux?

Use the ls command with -i option to view the file inode number. The inode number of the file will be shown in the first field of the output.

# ls -li 2daygeek.txt

1740436 -rw-r--r-- 1 daygeek daygeek 211 Feb 10 08:03 2daygeek.txt

How To Search A File Using Inode Number In Linux?

You can able to find the files using inode number in Linux. To do so, use the following format.

# find /home/daygeek/ -inum 1740436

/home/daygeek/2daygeek.txt

How To Check Inode Utilization On The File System In Linux?

If you would like to check inode utilization on the file system then run the following command.

# df -i
Filesystem       Inodes   IUsed    IFree IUse% Mounted on
/dev/vda1      13640832 1487624 12153208   11% /
devtmpfs         232604     326   232278    1% /dev
tmpfs            235277       1   235276    1% /dev/shm
tmpfs            235277     555   234722    1% /run
tmpfs            235277      16   235261    1% /sys/fs/cgroup
/dev/loop0       146592     139   146453    1% /tmp
tmpfs            235277       1   235276    1% /run/user/0

How To Count Inode Usage In Linux?

If you would like to count inode utilization in the current directory, use the following command. This will print the output without grand total.

# pwd
/home/daygeek

# find . -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn
  43113 ./.cache
  16491 ./.rustup
   4057 ./.mozilla
   3257 ./Documents
   3054 ./.local
   1869 ./.config
   1567 ./.npm
   1551 ./Videos
    964 ./.cargo
    249 ./Pictures
    185 ./Downloads
    177 ./.bundle
    158 ./yay
    155 ./Desktop
    145 ./snap
    139 ./batstat

How To Count Inode Usage In Linux With Grand Total?

If you would like to count inode utilization in the current directory, use the following command. This will print the output with grand total.

# echo "Detailed Inode usage for: $(pwd)" ; for d in `find -maxdepth 1 -type d |cut -d\/ -f2 |grep -xv . |sort`; do c=$(find $d |wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n"

Detailed Inode usage for: /home/daygeek
11  - 2g
46  - bash-insulter
140  - batstat
96  - betty
178  - .bundle
43114  - .cache
965  - .cargo
1870  - .config
156  - Desktop
3258  - Documents
186  - Downloads
60  - drivesync
3055  - .local
4058  - .mozilla
1568  - .npm
250  - Pictures
16492  - .rustup
146  - snap
64  - ssh-audit
1552  - Videos
159  - yay

Total:   77682

How To Check Inode Changes With Copy And Move?

Inode values doesn’t get change/modify when you perform the file move with in the file system. See the results below.

# ls -li /home/daygeek/2daygeek.txt 
1740436 -rw-r--r-- 1 daygeek daygeek 211 Feb 10 08:03 /home/daygeek/2daygeek.txt

# mv /home/daygeek/2daygeek.txt /home/daygeek/Downloads/

# ls -li /home/daygeek/Downloads/2daygeek.txt
1740436 -rw-r--r-- 1 daygeek daygeek 211 Feb 10 08:03 /home/daygeek/Downloads/2daygeek.txt

Inode values get changed/modified when you perform the file copy in Linux. See the results below.

# ls -li /home/daygeek/Downloads/2daygeek.txt
1740436 -rw-r--r-- 1 daygeek daygeek 211 Feb 10 08:03 /home/daygeek/Downloads/2daygeek.txt

# cp /home/daygeek/Downloads/2daygeek.txt /home/daygeek/Downloads/2daygeek-new.txt

# ls -li /home/daygeek/Downloads/2daygeek-new.txt
1743316 -rw-r--r-- 1 daygeek daygeek 211 Apr  5 09:51 /home/daygeek/Downloads/2daygeek-new.txt

How To Reduce The Inode Usage In Linux?

The only option is to delete the unused files to reduce the inode usage in Linux.

Bonus Tips For Website Owners

Most of the hosting providers were offering the Shared UNLIMITED hosting.

Is it true? No it’s not true because there is no UNLIMITED hard disk then how can its possible?

Every web hosters were provide some Terms & condition for INODE limits so, have a look on it before you buy the hosting.

If the shared hosting is not suitable for you then try Virtual Private Server (VPS) or Dedicated Server (DS) because there is no limit for inode usage.

Domains
  • Register a New Domain
  • Transfer Domain to Us
Support
  • Announcements
  • Knowledgebase
  • Network Status
  • Contact Us
Servers
  • High Performance VPS
  • Virtual Dedicated Server
  • Dedicated Servers
  • VPS Storage Servers
Company
  • About Us
  • Privacy Policy
  • Unlimited Policy
  • Acceptable Use Policy
  • Anti-Spam Policy
  • Refund Policy
  • Terms of services
  • Copyright © 2022 hostarina. All Rights Reserved.