What is inode & how it affects my VPS ?

What is inode ?

Inode is a system parameter which indicates how many files and folders are present in the server. As number of inodes that a server can accommodate is limited, unlimited usage of inodes can not be allowed.

Number of inodes allowed is determined based on VPS plan. This indicates that if you upgrade to a higher plan, you will be able to fill your VPS with more number of files & folders.

Is inode different from disk quota or disk space usage?

Yes, disk quota is another parameter similar to inode. This parameter indicates total size of files & folders that could be stored in server.


What will happen if number of inodes used exceeds allocation as per plan?

Your applications like mysql will fail to function if  number of inodes used exceeds allocation as per plan

How to avoid issues due to high usage of inodes

Choose a VPS plan which can accommodate as much files & folders you wish to store in server.


Note: Unused & old PHP session files may often cause high inode usage. Please check the link: Script to delete PHP session files for more details

How to view my inode usage

1. Login to server via ssh as root and run "df -i" command

-bash-4.1# df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/vzfs             250000  197338   52662   79% /
none                   65536      95   65441    1% /dev

In this example "250000" below "Inodes" indicates allocated number of inodes. "197338" below "IUsed" indicates actually used number of inodes.

How to find folders with maximum number of files & folders.

1. Login to server via ssh as root
2. Download http://files.bytehouse.co.uk/inode-counter.sh script & execute
3. The script will ask you to provide a path to analyse. You need to usually give the path as "/var" or "/usr" as they are the folders usually containing maximum number of files & folders in server
4. Result will be stored in a file similar to "inode-analysis-var.txt" or "inode-analysis-usr.txt"
5. You can view the result using the commands "head inode-analysis-var.txt" or "head inode-analysis-usr.txt"

-bash-4.1# wget http://files.bytehouse.co.uk/inode-counter.sh
--2014-03-19 07:05:48--  http://files.bytehouse.co.uk/inode-counter.sh
Resolving files.bytehouse.co.uk...
Connecting to files.bytehouse.co.uk||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 268 [application/x-sh]
Saving to: “inode-counter.sh”

100%[==========================================================>] 268         --.-K/s   in 0s      

2014-03-19 07:05:49 (44.5 MB/s) - “inode-counter.sh” saved [268/268]

-bash-4.1# bash inode-counter.sh

Enter path to analyse: /usr
-bash-4.1# head inode-analysis-usr.txt
101318 /usr
44409 /usr/local
34128 /usr/local/psa
26965 /usr/share
24063 /usr/libexec
23991 /usr/libexec/webmin
20209 /usr/local/psa/admin
12905 /usr/local/psa/var
12799 /usr/local/psa/var/apspackages
10241 /usr/local/sb

Last update:
2014-05-12 06:15
Sherin George
Average rating: 1 (1 Vote)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category