Fixing Inode Limit Issue in cPanel for CodeIgniter Websites
Fixing Inode Limit Issue in cPanel for CodeIgniter Websites

How to Fix Inodes 75000/75000 Issue in cPanel for a Self Hosted Website

Understanding the Inode Limit Issue in cPanel

If your cPanel account has reached the inodes limit (75000/75000), it means you have too many files and directories stored on your server. This can cause website performance issues, email problems, and even prevent you from uploading new files.

For CodeIgniter websites, certain directories like logs/, cache/, and sessions/ may accumulate files over time, leading to excessive inode usage.

How to Identify Large Folders Consuming Inodes

1. Using cPanel File Manager

  • Log in to cPanel.
  • Open File Manager.
  • Navigate to public_html (or the root folder of your CodeIgniter site).
  • Click on the “Size” column to sort folders by size.
  • Identify directories like application/cache/, application/logs/, and uploads/ that may be consuming too many inodes.

2. Using Terminal (If Available)

If your cPanel allows terminal access, use the following commands:

Find Folders with the Most Files

find . -type f | awk -F/ '{print $2}' | sort | uniq -c | sort -nr | head -10

Check the Total Number of Files

find . -type f | wc -l

Check Disk Usage of Each Folder

du -ah --max-depth=1 | sort -rh | head -10

3. Using a PHP Script (If Terminal is Unavailable)

Create a inode_check.php file in public_html and add:

<?php
function count_files($dir) {
    $file_count = 0;
    $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS));
    foreach ($files as $file) {
        $file_count++;
    }
    return $file_count;
}
$base_dir = __DIR__;
$folders = scandir($base_dir);
foreach ($folders as $folder) {
    if ($folder !== '.' && $folder !== '..' && is_dir($base_dir . '/' . $folder)) {
        echo "Folder: $folder - " . count_files($base_dir . '/' . $folder) . " files<br>";
    }
}
?>
  • Visit yourdomain.com/inode_check.php in a browser.
  • Delete the script after use to prevent security risks.

How to Reduce Inode Usage

1. Clear Cache and Logs

  • Delete old logs in application/logs/:
rm -rf application/logs/*
  • Clear cache files:
rm -rf application/cache/*

2. Delete Unused Files and Backups

  • Remove outdated backups and ZIP files from public_html.
  • Delete unnecessary images or files in uploads/.

3. Optimize Database and Sessions

  • If using database sessions, clear old sessions:
DELETE FROM ci_sessions WHERE timestamp < UNIX_TIMESTAMP(NOW() - INTERVAL 30 DAY);

4. Use a Cron Job for Automatic Cleanup

  • Set up a cron job in cPanel to auto-delete old log files:
find /home/yourusername/public_html/application/logs -type f -mtime +30 -exec rm {} \;

Conclusion

By following these steps, you can fix the inodes 75000/75000 issue in cPanel, optimize your CodeIgniter website, and ensure smoother performance. Regular maintenance, cache clearing, and log management will help keep inode usage under control.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *