Best Practices

Updated on Mar 16, 2018

In the last tutorial of these series, we provided you with the most common problems with different applications and their solutions in regards to the Inode count on your account. In this tutorial, we will be providing you with the best ways to avoid an exponential and unwanted increase in your Inode counts while maintaining your account healthy will also impact other resources like Disk Usage and Bandwidth as these three resources are inherently connected.

  • Emails - Again, we are seeing that older emails, spam, and even full email trash are the most common culprits in yet another resource over usage. While we already have a dedicated email optimization section for dealing with emails in which you can check how to perform export, cleaning, trash empty schedule and applying spam filters to reduce the amount of spam you receive, here we will still mention those methods as a viable option when cleaning Inodes. As each mail is a separate Inode having multiple mailboxes full of spam is the quickest way to get to a critical amount of Inodes quickly.
  • Backups - We completely agree with production environments being backed up on a regular basis. However, when you start forgetting to clean your older obsolete backups which are just laying around your /public_html folder, you are missing out on potential Inodes being freed for other uses. Make sure that you have a local copy of everything important in your hosting account and then remove these older backups via an FTP client or cPanel's File Manager.
  • Dev/Test Environments - Developing and testing new features for your website is a great way of increasing your visits and growing a successful business. Most of the time this requires full copies of your live environment, so we are talking about entire websites being duplicated here. Having a separate Magento store on top of your existing one is such a case. If a constant dev environment is required, customers should consider higher plans with more Inodes like our VPS and DS solutions. If you only need a temporary testing playground, you can always make one as long as you are in your Inode limit, but erasing it after the task has been completed will assure you have enough Inodes for your hosting account's smooth operation in the future.
  • Large Cache Folders - Caching is very important for a speedy delivery and user retention. But as with many good things, there are a few cons to consider, one of which is the immense volume of files is created when caching is enabled. Especially if we are talking about non-incremental caching which creates additional instances of the changed files each time they are modified as we have seen in some applications in our Most common Inode over usage solutions tutorial.
  • cPanel's Default Email Account - We decided to separate this from the first point of this tutorial to distinguish that this email's creation is not a user choice. However, there is still a need for maintaining it even if you almost never receive actual useful information in your default account. Misdirected spam and Cron job notifications will often plague this account to the point of being time-consuming to remove all of the emails there. We recommend removing these emails via Webmail service. However, you can also use FTP/File Manager as long as you are careful in what you remove. This email account is located in the home/user/mail folder of your account. There will be two folders called new and cur.

Warning

It is very important that you do not remove the folders themselves and only delete the files inside due to the recreation process for these folders which can partially corrupt your hosting account environment.

  • Cron Jobs - Cron Jobs are used to schedule an action (output, call, or script execution). The schedule can be done on an interval by the minute, hour, day, month and exact weekday. They are very useful and can be seen being generated in the cPanel Cron Job section by applications such as Magento, OpenCart, and Drupal. Cron Jobs can also be configured manually, but with their great utility comes a few possible hurdles which affect your Inodes. Firstly, the output of a successfully executed cron job is sent via email to your default mail account. To avoid that you can add one of the following strings at the end of your command:
    &> /dev/null

    or

    >/dev/null 2>&1

    The first will redirect the standard command output to the null device, which is a specifically made to discards the information which is sent to it, while the second will redirect the standard error stream to the standard output stream which prevents any output from the command being available.

    Secondly, most commands utilize wget and curl which create a file with the output of the command in the home folder of your hosting account. Considering that Cron jobs can be run every few minutes, the number of files with output can flood your account fast. For example, if you have the following wget command:

    5 * * * wget -O /dev/null -o /dev/null example.com

    The -O will send the downloaded file to /dev/null, and the -o will send the logs to /dev/null.

    A similar result can be achieved with:

    5 * * * wget -O - mysite.com > /dev/null 2>&1

    For curl you can take a look at the following example:

    1 1 * * 0  /usr/bin/curl --silent http://example.com/some.php &>/dev/null

If you still see a high amount of Inodes, you should check our Inode Usage tool in your cPanel and locate the Inode cluster, causing the issue. If there are no other files, which you can backup and remove, consider an upgrade as the shared hosting environment is limiting the growth of your website and business. Our VPS and Dedicated Server plans are just one click away in situations like that.

On this page...

    Optimized SSD Web Hosting

    • Free Domain for life
    • 24/7 Technical Support
    • Fast SSD Storage
    • Hack-free Protection
    • Free Script Installation
    • Free Website Transfer
    • Free CloudFlare CDN
    • Immediate Activation
    View More