Inodes Explained


Inodes Explained

Inodes are one of those things we rarely talk about unless their use becomes a problem. They’re fundamental bits of a file system that quietly do their job without any intervention from us. But there may be occasions when you need information about your account’s inode use.

This article will:

Where to See Your Inode Usage

In cPanel, you’ll notice the inode term is replaced with “File Usage.” That’s because they are essentially one of the same thing. We’ve just simplified the terms to make it easier for some of our customers.

If you need to know your current usage, you can:

 

Easy Method: Check cPanel

You can see how many inodes you are using in cPanel account.

  • Log in to cPanel.
  • In the “Statistics” section in the right column, look for “File Usage.”

The first number is the number of inodes used. The second is your account’s inode quota.

So in our example, 27,481/150,000, we are using 27,481 inodes, and our limit is 150,000.

 

Advanced Method: Shell Commands on the Server

If you want more details about inode usage, you can log in to the server and run commands that display inode counts.

First, make an SSH connection.

 
To see the total number of inodes used, run this command:

find . | wc -l

 
To see a detailed list broken down by directories, run this command:

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”

 

What Is an Inode?

Inodes represent objects in the file system. Think of them as tiny index files.

When you upload a file to your website (or to any disk or solid-state drive), the data that makes up the file is stored in multiple blocks. Those blocks aren’t always arranged in neat groups. They can be scattered across different areas of the disk.

The inode contains instructions that let the file system know where to locate the data on the disk. It also includes some other information, or metadata, about the file.

The quick answer is because there are a limited number of inodes available in any file system. Every file on the system has a corresponding inode. A huge file uses a single inode in the file system, but a tiny file also uses one inode.

A website that’s designed to generate or use many small files may not seem like a problem. After all, hundreds of thousands of tiny files take up very little storage space, right? They take up very little physical space, yes, but they consume a large number of inodes.

Inode Limitations Are in Place to Prevent Server Problems

Since the total number of inodes for the file system is limited, individual file system users (or web server users) have to be limited in how many they can create. If there were no limitations, a single user on the server could use all the available inodes while using relatively little storage space.

For the same reason, a hosting account may reach an inode limit before it reaches a storage space limit. To prevent a single user on a server from consuming all the available inodes, quotas are in place.

Inode quotas aren’t specific to only our DC. Every shared hosting provider imposes per-user inode use limits.

How to Reduce Inode Usage

The only way to reduce inode use is to reduce file use. When you delete a file, its inode is deleted as well. So here are a few ways to reduce your inode use.

 

1. Delete Unused Files

The first way to reduce inode/file use is the simplest – delete unused files from your account. Some of the major culprits here are unused CMS installations. Many of us will install WordPress, Joomla, Drupal, or another CMS to give them a try. If we decide not to use them, we don’t always delete the installations.

Most CMS packages contain hundreds—if not thousands—of files, so deleting them can reduce file use. As a bonus, older versions of CMS can be targets for hackers, so removing unused installations improves your website security.

 

2. Use Cloud File Storage

The second most effective method is to consider external file storage. Google, Amazon, and Microsoft all have cloud file storage systems, as do hundreds of other companies. If your site uses a lot of small files that can be stored on another server, such as images or documents, remote file storage can help lower your website file count.

The difficulty in setting up a site to use remote file storage varies depending on how your website is configured, and whether you use a CMS. But the benefits can outweigh the setup costs.

 

3. Check Your Email

Finally, something that’s often overlooked when it comes to inode use is email. Your account’s inode quota includes all the files related to your account. That means not only website files, but email as well. If you can purge older email or large spam folders, etc., you can free up a lot of inode space.

If you have any questions that we haven’t answered, please feel free to write back us on helpdesk @ xperts.net.pk