Nội dung
In this article, AZDIGI will show you how to check the number of inodes on your Linux server/hosting package.
I. What is Inodes?
An inode is a data structure in a Unix-style file system that describes a file system object, such as a file or directory. Each inode stores the properties and disk block location of the object’s data. File system object properties can include metadata, as well as owner and permission data.
Or you can understand more simply that inodes are the number of existing files + folders.
Usually, inodes will often be mentioned on Unlimited Hosting packages. So what is an inode? Hosting inodes are the number of files and folders in a hosting account. Inodes represent the number of all files located on your hosting account. For example, an email in your account will be 1 inode, an email containing 2 attachments will be 3 inodes.
II. Check the number of inodes on the Linux server
I will divide it into two cases to check the number of inodes on Linux, which one is on the VPS/server you are administering, the other is on the hosting package you are using.
Case 1: On the VPS/server you are administering
Before going into the steps to check the number of inodes on a Linux server, we should understand why monitoring the number of inodes is important.
If you don’t know already, every system has its inodes limit, and your system will have big problems when you hit the inodes limit. This can happen even if the server still has enough free storage space, using 100% of the inodes limit in the system can block the creation of new files. Besides, it may lead to the system stopping suddenly.
To check the number of inodes on the Linux VPS/server, we need to follow these 2 steps.
Step 1: SSH into your server
To check the number of inodes on the Linux server, we first need to SSH or access your VPS or server as root. Or at least log in to the server with a user with sudo
privileges. If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:
After successfully SSH, we continue with step 2 to perform commands to check the number of inodes on the Linux server.
Step 2: Commands to check the number of inodes on the Linux server
To get the number of inodes in the root directory (/
), open a terminal window and run the following command:
cd / df -i
As shown above, my /home
directory takes up the most inodes. You can use the following additional command to list the 50 directories containing the most inodes:
cd ten_thu_muc find . -xdev -type d -exec sh -c 'echo "$(find "$0" | grep "^$0/[^/]*$" | wc -l) $0"' {} \; | sort -rn | head -50
Step 3: Usage statistics/inode limit on VPS/server
After knowing the number of inodes
you have used, we continue to check how much our system limit is and the usage rate with the following command:
df -ih
Here is my result.
As you can see in the above result, my limit of inodes is relatively high, and I don’t have to worry about full inodes yet.
Case 2: On the hosting package
In this case, it will be available to those using hosting packages with Terminal
enabled. First, you will access your cPanel interface or cPanel with SSH protocol if you are using hosting at AZDIGI.
I will guide you on the cPanel interface for you to understand.
At the cPanel interface, find and access the Terminal feature, as shown below:
At the Terminal interface, we use the following command to check the number of inodes used.
find . | wc -l
As my results below, I used 9352 inodes.
If you want to know which directory takes up the most inodes, you can use the following command:
find . -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn
On my server, there is a directory that uses most of the inodes: labcpanel.
You can completely use the command cd ten_thu_muc
and repeat the above command to check the number of inodes of the subdirectories inside.
cd ten_thu_muc find . -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn
Keep repeating like that and you will find folders that take up a lot of inodes.
So we know how to check the number of inodes on the Linux server.
If you can’t find the Terminal feature on your server, please contact technical support so we can assist you.
III. Summary
Through the above methods, we have learned how to check the number of inodes on the Linux server and host cPanel. Hopefully, through this article, you will learn some certain knowledge to help you better manage your service.
Wishing you success. See more useful articles about Linux at the following link:
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com .