Recently, a client of ours called to find out why their file usage was spiking when they were not uploading any files or making any changes to their website site. They are using cPanel so we should have been able to find out easily, right? Maybe not.
First thing, let’s take a look at what the file usage is. It is not to be confused with disk space! File usage is also known as the inode limit, and it is the total number of files and folders on your site. Disk space is the total amount of bytes that your hosting is capable of holding. Your web hosting usually has a limitation on the file usage even if you have unlimited disk space. This is to prevent crazy file storage that will slow performance of your web hosting, especially if you are on a shared hosting package.
On our client’s hosting, the limit was 200k files for every shared hosting package. If your file usage reaches maximum capacity, your hosting will stop allowing you to upload any files. This can result in errors on the frontend site because the Content Management System usually creates files and folders automatically.
OK, so why is my file usage is spiking?
Debugging this issue with cPanel was a little bit tricky because they don’t supply file usage statistics, like Disk Usage. The easiest way is doing it locally. Make a full backup of your site and download it using your finder (mac) or explorer (windows) to see where the bottleneck is.
Uh, I don’t have time to download gigs of data.
Yeah, us too. Our debugging process started with the public_html folder, to see if there is some long trail folder with many files in it. If your public_html folder contains any weird files that you don’t recognize, that can mean your site has been compromised. The dreaded hack! Pray for clean files!
If you think your files look fine, then try your email folder. It’s usually located in the root/mail folder.
The email file sits under new or tmp folder. In this case, the new folder is 1.4 Mb in size which is not normal. When we opened that folder it took ages load and once it did it just shows nothing or sometimes a data error.
This is suspicious, so we tried to see if any email account exists because this site does not handle email. There is a hidden default admin account as you can see here:
Gotcha! It seems that the email is responsible for the spike in file usage. Every email counts as 1 file on your hosting.
The email content seems to be straightforward in telling you where the email came from, this is because a CRON Task has been set to send an email every time it is run. To fix this please go to the CRON menu and edit the existing CRON job.
You can use this snippet to prevent the system sending an email every time a CRON job is run:
Basically, this snippet is to force the system to send the email to a black hole, for more information about this command you can visit this site.
After we found that the email was the cause of the file usage spike, the last step was to delete/clear the inbox and you will clean up file space.
This is how we solved the file spike usage on our client’s site, the problem may vary with each site. If you end up struggling and still no luck, you can contact us, and we will be happy to help.