Most common Inode over usage solutions

Updated on Apr 16, 2018

While there may be many reasons for extra Inodes in your hosting account, here we will take a look at the most common cases including leading software in the hosting industry. From cache folders through session files and thumbnails that create duplicates of images – the inherent way some applications are made to work is the main factor in creating extra Inodes on your account.

Quick access to the application which you use:

part

magento application Magento

Both Magento 1.x and 2.x can generate massive amounts of inodes when left unattended for long periods of time. In 1.x you have a greater variety of file generating processes which are not tied to the cache and thus have to be removed separately.

Cache - The cache and sessions files are the ones you should be careful with. Considering you will have to purge the cache every time you make a change in your products selection, regularly cleaning the cache folders is just one of those things, shop owners must do. Large product catalog stores can contain a lot of cache, and even some for images of long ago removed products.

To secure your data, create and download a Database backup of your store. Then navigate to the admin area and go to the System → Cache Management section to click the Clear the Magento Cache and Flush Catalog Images Cache buttons.

Check our How to clear your Magento store cache article for more information on this operation in Magento 1.x and our How to Manage the Cache in Magento 2 tutorial for the same procedure in Magento 2.x.

Temporary files - You can safely remove all temporary files which are still stored in the var/tmp folder

Old imports - Importing data always leaves a trace when it comes to hosting that same data. We suggest you check your var/import folder for older imports which can consist of products, customers, and even extensions.

Sessions - The session files for Magento are generated inside the public_html/var/sessions. By deleting all files outside the range of the last few days (or last session), you will have one less probable troublemaker to worry about. To remove old sessions via SSH, you can type:

find /path/to/magento/var/session -name 'sess_*' -type f -mtime +7 -exec rm {} \;

as the number can be changed depending on the number of days you may want to keep the last few days or only the last day worth of sessions

Reports - Check and clean your Magento reports in var/report. While it is advisable to check on your reports and fix the issues of your website in their core, to just stop the application from creating additional reports you will have to navigate to the reports.php file and find the following function which is called in the process of creating a report:

public function saveReport($reportData)
{
    $this→reportData = $reportData;
    $this→reportId   = abs(intval(microtime(true) * rand(100, 1000)));
    $this→_reportFile = $this→_reportDir . '/' . $this→reportId;   
    //...snip...
    @file_put_contents($this→_reportFile, serialize($reportData));
    //...snip...
}

Now comment the following line and you are done:

#@file_put_contents($this→_reportFile, serialize($reportData));

Logs - While your Magento website might be running smoothly, there is still a log being generated every time something "moves". Over time this will accumulate to a lot of bloat in your var/log folder. Remove the excessive files, but not before inspecting them for actual issues already logged by Magento. To remove the log files, go to System → Configuration → Advanced → System → Log Cleaning

part

prestashop application PrestaShop

One of the most common issues with PrestaShop is that its caching system works very badly optimized. The infamous cachefs folder will grow substantially in size over time due to files being cached as new instances every time instead of the old entries of the file being removed/overwritten once a change of the file has been made. This calls for action which can be either cleaning the cache or temporarily disabling the caching option. The second variant works well if you make changes to your shop on certain intervals, so you can make the change, enable cashing and then before the next change disable it again while cleaning the old instances of your products cache.

Clear Cache - Sometimes you may need to clear the cache without accessing Back Office. By using your favorite FTP client or your cPanel's file manager access the folder of your PrestaShop instance and delete everything except the index.php files in the following directories:

/cache/smarty/compile/
/cache/smarty/cache/
/cache/cachefs/
/img/tmp/
/themes/your_theme/cache/

To clear the cache of your classes and controllers, remove the /cache/class_index.php file. This is the only core index.php file you can safely remove without risking issues with your website.

Disable Caching - In contrast with the cleaning cache procedure, to disable caching altogether, you will need administrative access to the Back Office of your PrestaShop. Access the Advanced Parameters → Performance section which is identically placed for both version 1.6 and 1.7.

After that you will have to turn the Template compilation: Force compilation setting on and then mark the Cache option with a No. Now you can turn off the Use Caching option as well as all options in the Combine, Compress, and Cache section. Save the changes and you are done.

part

drupal application Drupal

In the case of Drupal, you'll find a large number of files inside the cache folder of public_html/cache. We recommend clearing it approximately every month (you can create a cron for it).

part

joomla-application Joomla

Like Drupal, the typical location for a large number of files is the public_html/cache folder that should be cleared on a regular basis. You can create a cron for this as well.

part

wordpress application WordPress

Thumbnails - The thing that many people miss is that Wordpress doesn't just upload one version of each image. Depending on the theme or different plugins installed, you could have a dozen or more images being created for every image you upload. So if an image gallery plugin tells WordPress, it needs five different sizes (to use in different gallery layouts, for example), and a theme has 4 different thumbnail sizes it needs for different layouts, and Wordpress itself needs a small, medium and large, it can really add up.

So you need to look in your images directory, and you will be able to see how many image copies are created by each plugin. If there are a lot, you may need to check the plugin that is creating them, and re-configure it. Or you can also disable a certain size in your functions.php file. To do this, log in to your WordPress Dashboard and navigate to Appearance → Editor. You will see a warning which you should read and follow as modifying these files can seriously damage your WordPress install and as such a child theme use is strongly recommended.

Next, you will have to find your current theme's function.php file and click on it. Then search for:

add_image_size and set_post_thumbnail_size

If you get a result, it means that your theme is generating thumbnails in certain sizes. If you are sure you don't need this extra thumbnail generation, remove the selected code and click on Update File.

Once you have properly disabled the different sizes, that won't delete all the previously uploaded variations. You will need a plugin like Force Regenerate Thumbnails, which will delete all current thumbnails/image sizes and recreate them based on your new settings. Addressing this across your whole Wordpress media library can clear up a lot of inodes if you are running an image site. It may not be your only problem, but definitely somewhere to look. One more thing to note is that you should not go deleting the images through FTP or the cPanel's file manager. Only do it through WordPress itself or the WordPress database won't know they are gone. WP references every image in the database which may lead to unwanted results if the actual images are removed.

Inactive themes and plugins - Plugins and themes, especially paid and more complex ones tend to bloat WordPress installations. Not only with their initial size but also with every update and sometimes extra data that is generated like cache and log files. Removing resources which you don't actively use is a great way to lower your Inodes and if you ever need a certain theme or plugin, you can easily re-install and re-activate them.

Optimization plugins - While optimization plugins like W3 Total Cache and WP Rocket can increase your WordPress based website's speed, at the same time, they will create a lot of Inodes while running their caching processes. Plugins like WP-Rocket - one of the most used optimization plugins for WordPress have an easy to navigate UI and provide clear/purge cache features with a single button click. Alternatively, you can flush your WordPress based website's cache by using SSH and a WP-CLI command.

Navigate to the directory of your WordPress install and execute:

wp cache flush

After that you will see the confirming message:

Success: The cache was flushed.

Those are the most common high Inode usage cases we have seen from the most popular apps. If you still have a high Inode count even after cleaning your Magento or WordPress, we suggest you use our Inode Usage tool in your cPanel for further information on where in your hosting account are such removable files situated.

On this page...

    Optimized SSD Web Hosting

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