“Inode” is a term used in Linux/UNIX file systems. Each file, directory, symlink… is represented by an inode which has a bunch of information on the file or directory (check out Understanding UNIX / Linux filesystem Inodes for more information). Computers running Linux have a maximum number of inodes allowed, i.e. a maximum number of files and directories, independently of their sizes. This number is quite big so in general it won’t affect you. Furthermore, if you are running Windows you might be tempted to skip this post altogether. But if you have a domain in a hosting service and your web hosting package is in a Linux server, you should definitely continue reading. In my previous post Hostgator pros and cons, I explained how it has a maximum of 50,000 inodes quota and how it’s not that difficult to reach that number. Whether you are using Hostgator as your web hosting provider or any other, you should know about inodes and how their shortage can become a problem. In this post I will go through ways to find out how many inodes do you have. In the 2nd part, I am going to compile a list of the number of inodes different packages have when you install them (important if you want to run WordPress, TYPO3, Mambo, TikiWiki…).

To find out how many inodes are there in a folder or web hosting account, there are three ways. Whether one or another are possible, or all three, will depend on your web hosting provider.

Option 1. Submit a ticket

This one is easy and only takes as long as your provider’s support takes. Just ask them for an inode report on your account. Hostgator complied within 4 hours, and that was for three different accounts.

Advantage of this method: little effort and you don’t have to learn any commands.
Disadvantage of this method: if you haven’t been warned of being above the inode limit, you might be calling their attention to your account unnecessarily. Furthermore, you depend on others to know the number of inodes.

Option 2. Via ssh

If your provider allows you to ssh to your account, then once you are connected, all you have to do is type the following:

find . -printf "%i\n" | sort -u | wc -l

Advantage: quick (it can take 20 seconds to count 10,000 inodes).
Disadvantage: not all web hosting providers allow you ssh access. In Hostgator, for example, you can ask for ssh access but you need to give them a copy of your photo id.

Option 3. Via ftp

This can’t be done using FileZilla or similar. From a Linux machine you must open a terminal and:

  1. First make sure you have the curlftpfs package installed. Depending on your Linux distribution it can be as simple as running (as super-user)
    yum install curlftpfs
  2. Then you have to create the directory where you want to mount the ftp connection to your hosting account.
    mkdir ftp-domain-folder
    where ftp-domain-folder is the name of the directory you chose.
  3. After that you connect to your account.
    curlftpfs -o user=xxxx:yyyy ftp://domain-name.zzz/ ftp-domain-folder/
    where xxxx = user name and yyyy = password.
  4. And you run this command to count the inodes.
    find ftp-domain-folder/ | sort -u | wc -l
  5. Finally, unmount the folder (requires super-user priviledges):
    umount ftp-domain-folder/

Advantage: you can do it from your computer, quite easy, no need for ssh,…
Disadvantage: it takes quite a bit (over an hour to count 10,000 inodes) and you need to run the commands from a Linux computer.

To check the total number of inodes, if you don’t have ssh access, I would suggest using option 1. Once you know the total number, you can use option 3 to find out the inode count in folders within your hosting account. Each individual folder will not have as many inodes as the whole account so the command will take less time. For example:

find ftp-domain-folder/mail/ | sort -u | wc -l

where mail is the folder where all your email accounts and emails are, or:

find ftp-domain-folder/public_html/folder-name/ | sort -u | wc -l

to check the inodes inside a folder in your account. This way you can check if you have erased enough files if you were reaching the limit.



Subscribe to olivetalks to receive an email whenever a new post appears in the category of your choice.
Print This Post Print This Post

Tags: , , ,

11 Responses to 'The attack of the inodes – how to find out your number'

Subscribe to comments with RSS

  1. June 3rd, 2008 at 10:58 pm
    MikeFL said,

    I can’t post my website link since some (moron) hacked my files… I asked Hostgator for help and was referred to their TOS for inode limits. Apparently, I’m “slightly over”. I Googled for Hostgator inodes and found this code which I used and it seems to work. It was posted in the HG forums. It is PHP, so start and end the code accordingly and save it as a PHP file (mine is inodes.php). Here is the line (remember, this is for Hostgator) and put the line between :

    system("/usr/bin/quota | /bin/awk '{ if ( $5 ~ /^[0-9]/) total+=$5 } END {print \"Total Inodes :\" , total}'");

  2. June 5th, 2008 at 8:21 am
    How To Count Inodes said,

    How To Count Inodes?

    1-) Create a new empty PHP file
    2-) Copy the code and edit the username
    3-) Save as inodes.php
    4-) Upload it to your public_html
    5-) Look on the web at yourwebsite.com/inodes.php

    PHP CODE:

    system(”find /home/username/ -printf ‘%i\n’ | sort -u | wc -l”);

    Note: Where username is your cPanel username

  3. June 5th, 2008 at 1:54 pm
    LadyRostand said,

    MikeFL, when you get the control of your website back, let us know and we will edit your contribution and add the link.

    How To Count Inodes, your three comments have converted into one as requested.

    Thanks MikeFL and How To Count Inodes for your code suggestions!

  4. October 19th, 2008 at 2:40 pm
    bogdanel said,

    well, to post here my solution also:

    [code]$inodes = `find /home/username/ -printf “%i\n” | sort -u | wc -l`;
    echo $inodes;[/code]

    this is useful if you’re trying to make a script that alerts you about the inode limit.

    btw, for wordpress users i recomend wordpress+wp-hive plugin (if you have more than one blog hosted), wordpress-mu (if you want a multi-user blog environment) and zen-photo. all of this, with around 6 albums in zenphoto and a huge dokeos install were 9,168 inodes.

  5. October 27th, 2008 at 6:35 pm
    LadyRostand said,

    Thanks bogdanel! Also for the wordpress installations suggestions.

  6. December 19th, 2008 at 6:02 am
    Vivian said,

    MikeFl’s suggestion worked perfectly! Glad I found a solution to it here so I don’t have to ask for ssh access.

    I’m at 43,000 inodes. Yikes 🙁 Not good…

    Thanks for all the excellent posts on Hostgator limits, LadyRostand!

  7. December 24th, 2008 at 8:37 pm
    LadyRostand said,

    Hi Vivian, thank you and did you see the inodes limit of Hostgator has increased? I must admit I also use MikeFL’s php code suggestion to calculate the number of inodes in my accounts now 🙂

  8. December 31st, 2008 at 11:47 pm

    HI

    MikeFL’s suggestion works well for finding inodes used by a single cPanel hosting account. Thanks for posting this information. I put following code in a file named inodes.php and uploaded it to public_html folder.

    accessed it like domain.com/inodes.php
    It directly shown “Total Inodes : xxxx”

  9. September 4th, 2011 at 9:40 pm
    sharad k said,

    i recently received inodes violation mail from my hostings., they allowed 250k and i was using 750k+ , i wasnt even hosting large number of files., then i came to know the catch all email account is causing this issue, and when i checked my catchall email inbox., there were like 60k unread emails, i removed those emails and moved my sites to new host’s vps, and now i am good., but idk whether the vps also has the inodes restrictions.,

    this is a good article about inodes , previously i was confused, but this post made clear.
    cheers.

  10. March 21st, 2013 at 4:06 am

    Could I make another suggestion for a 4th option? PHP Shell offers a way to run commands as if you are in a shell on the server. So, if you don’t have SSH access, I would recommend installing PHP Shell.

    http://phpshell.sourceforge.net/

    You can use the “cd” command to change directories, or there is a drop down to pick a directory. Then, you can run:

    find . -printf “%i\n” | sort -u | wc -l

  11. March 21st, 2013 at 5:35 am

    […] I found this command would do the trick: […]