Do you want to know more about the Linux inode and methods to reduce its usage?
Linux tracks files using a catalog system much like how libraries track books using paper cards. Every file in Linux has a “card” known as inode (or index node).
At Bobcares, servers owners often approach us with exceeded inode usage errors and we fix it as a part of our Server Management Services.
To know more about Linux inodes and its usage, read on.
What is an inode?
The inode stands for the index node. The number of inodes indicates the number of files in the Linux server.
In Linux everything from images, videos, emails, spams, website contents, backups all are files and inode counts every single file.
This is where inode usage needs proper monitoring. If a server has a lot of junk files, spam emails, and old backups, it uses up the allowable inode limit.
The consequence is, the user will not able to make any new file, which can cause websites to crash or mails to bounce.
Even if there is plenty of space left on the server, the user cannot create any files if all inodes are already used up.
So we reduce inode usage by constantly deleting spam emails, unwanted files, older backups, and clearing cache.
How to check Linux inode usage?
Usually, we check the inode usage via the terminal. And to check this, first SSH into the server as the root user and run the command,
df -i
And the result appears as,
To maintain the performance of the server shared hosting, accounts usually have limits for inode usage. And if the inode limit exceeds then certain action will be taken according to the hosting plans.
How to reduce inode usage?
The inode usage track the number of files present in the account. We determine this so that the files in the account don’t fill the disk. We can reduce this in different ways like,
1. Remove unnecessary files/folders
We use a file manager or FTP to remove any unwanted files or folders from the account. This basically reduces the inode usage in the server.
Also, we can remove the files via SSH as well. We also remove the old backups from the server if not required.
2. Clear the cache
Many CMS like WordPress, Drupal, Joomla, etc store cache on the website.
They store these cache to improve the website performance and load time. These also count to the inode usage. So by clearing these cache, we reduce the inode usage.
3. Delete the Spam emails
Almost all accounts will have any spam emails in the email account. Every single email counts to an inode number. So by deleting these emails, we reduce the inode usage.
Also, deleting any emails from the queue reduces inode usage.
A common error related to inode usage
Recently, one of our customers approached us with the below error message in the account.
No space left on device or running out of Inodes.
He deleted many files including the old emails as well. But still, the inode usage didn’t reduce. So our Support Engineers ran the below command to confirm about the inode usage
df -ih
Then, we ran a bash command to check which directory with the most number of files.
for i in /*; do echo $i; find $i |wc -l; done
Hence, we found the exact directory that caused the error. And then, we deleted the files from the directory and fixed this error.
[Need any assistance in reducing inode usage? – We’ll help you.]
Conclusion
In short, the inode is the number of files present in the server. If the inode limit is reached, the user can’t add any new file to the server. Today, we saw how our Support Engineers found the inode usage in the server and fixed the error.
0 Comments