How to check inode usage on linux for a specific cpanel user account or directory

If you’re a linux system administrator you’re probably already familiar with the term “inode”.  For those of you who are not, an inode is basically a way to measure the amount of files a user has.  This includes every email, cache file, image, and so on.  If it has a filename it is considered an inode.  Normally hosts will use this as a way to determine clients that need to be removed from backups because of the IO load they put on the server from the amount of inodes they have.

A few ways to measure this are…

Using the script I created and posted on GitHub:
https://github.com/tripflex/inodes

Or …

Current Directory

Navigate to the users directory you want the inode count for

cd /home/theuser

advertisement:
smyles 56 33
sMyl.es

Now use this echo code below and you should get something similar to the output you see right below it.

echo "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 "$ctt- $dn" ; done ; printf "Total: tt$(find $(pwd) | wc -l)n"

Here’s what it should like like after executing it:

echo "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 "$ctt- $dn" ; done ; printf "Total: tt$(find $(pwd) | wc -l)n"
Inode usage for: /home/theuser
26              - attachments
2               - .cpaddons
64              - .cpanel
1               - downloads
20              - etc
1               - .htpasswds
2               - .HttpRequest
25084           - mail
2               - .matplotlib
9               - .MirrorSearch
1               - perl5
6               - public_ftp
7466            - public_html
4               - .softaculous
1               - .sqmailattach
2               - .sqmaildata
11              - ssl
959             - templates_c
682             - tmp
1               - .trash
Total:          34379

In the example above we have 34,379 inodes under theuser’s account.

Coming Soon

I’ll write a script soon to incorporate something similar to this to automatically remove users from backups and send an email when it goes over specified limit.

Wikipedia

http://en.wikipedia.org/wiki/Inode

 
Source: sMyles
centos count directory inodes cPanel file count file system how to check inodes error linux inode inodes Linux node