Blog

Check inode availability for your server

Tags: dfdiskdisk spaceinode

Published on: February 28, 2017 by Manu M.

Check inode availability for your server

Scenario:

Hello Folks,

This is my first post of the year and covers on how to get the count of inode in your server/account. Before going on further, let me describe what inode is.

inode

inode is a data structure used to represent a filesystem object, which stores the attributes and disk block location(s) of the file system object’s data. Got it? Well, all you need to know (for now) is that a Linux file is “stored” in two different parts of the disk – the data blocks and the inodes. The data blocks contain the “contents” of the file. The information about the file is stored in the inode.

So, why this Blog?

Do you have a hosting account? Does your hosting provide you and unlimited disk space? Usually, any web-hosting company will provide you hosting accounts with a good amount of disk space. However, there will be a certain limit in the inode usage for each account they provide. In many cases, the issue with the account is over usage of inode. So this kb helps you to find the inode usage in a user account.

Finding inode usage

Just login to your account via SSH and run following command from there

find . -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn

Here is more about the command, just in case if you are curious 🙂

find . – for doing the search in current directory (. can be replaced by full path)

-printf “%h\n” – prints leading directories of file’s name.

cut -d/ -f-2 – trimming the output with de-limiter “/”

sort | uniq -c – sort and count

Sample output would look like this.

manu@sage17:~$ pwd
/home/manu

manu@sage17:~$ find . -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn
26126 ./.cache
9873 ./.config
7387 ./Downloads
3142 ./.tor-browser-en
1452 ./Pictures
540 ./.local
402 ./.thunderbird
338 ./Desktop
323 ./.mozilla
139 .
74 ./firefox
62 ./.gconf
50 ./.compiz-1
48 ./.pulse
41 ./.fontconfig

How to read the output

As you can see the first column is the inode count and the second column is the directory. So with this, you can find the directory which uses up high inode and advice customer accordingly.

So if your hosting company has promised an unlimited storage, don’t forget to ask them about your inode limit and make sure you are within the limits always

Get 24/7 expert server management

Category : Howtos, Linux, Troubleshooting

Manu M.

Manu M.

Manu has been with us for past one and half years and is a person with good technical skills and domain knowledge. Being a highly athletic personality, Manu likes to play Cricket and Badminton of all games whenever he gets time off. Apart from his technical and athletic abilities, he is a good writer and has tried his hands on penning a few poems of his own. He believes in the mantra that "small things matter the most" and this nature can also visible in his blogs and writings.

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Categories

Your Cart

Cart is empty.

Subtotal
₹0.00
APPLY
0
Send this to a friend