Knowledgebase

Disk Full or Inode Limit Reached: How to Free Space on cPanel and a VPS

To free space when a disk is full or the inode limit is reached, first find what is using the space or the file count. On cPanel use Disk Usage and Email Disk Usage. On a VPS use df -h, df -i and du. Then delete or archive the biggest offenders, which are usually old backups, oversized logs, mailbox trash, cache and session files, Docker leftovers, old kernels and MySQL binary logs. This guide covers both cPanel shared hosting and Ubuntu 22.04/24.04 VPS or dedicated servers.

Prerequisites

  • cPanel login, and access to Terminal (cPanel » Advanced » Terminal) or SSH if your plan includes it.
  • For a VPS: SSH access as root or a sudo user.
  • A recent backup, or a copy of anything you are not sure about, before deleting it.

1. How do I know if disk space or inodes are the problem?

Typical symptoms include:

  • Uploads fail.
  • WordPress cannot update.
  • Incoming emails bounce with "mailbox full" or "quota exceeded".
  • MySQL reports errors such as Errcode: 28 - No space left on device.
  • The site shows a 500 error or goes down completely.

An inode is one file or folder. You can run out of inodes while plenty of space is still free, usually because of millions of tiny cache, session or email files. On cPanel, compare Disk Usage and File Usage in the Statistics sidebar of the cPanel home page. On a VPS, check both:

df -h     # space per filesystem
df -i     # inodes per filesystem

2. How do I free disk space in cPanel?

Find the large folders

Open cPanel » Files » Disk Usage. The table lists each top-level folder and its size. Click a folder to drill down in File Manager. Watch for these common space users:

  • Files named backup-*.tar.gz in your home directory.
  • Old Softaculous backups in softaculous_backups.
  • Leftover ZIP archives.

Download anything you want to keep, then delete it from the server.

Clean up mailboxes

Go to cPanel » Email » Email Disk Usage and select a mailbox. You can delete messages by criteria, for example everything in Trash or Spam, or messages older than a chosen number of days. Large Sent and Trash folders are among the most common causes of a full account.

Remove oversized error_log files and cache

PHP writes an error_log file into each folder where an error occurs. In Terminal, list the large ones and empty them:

find ~ -name error_log -size +5M -exec ls -lh {} \;
find ~ -name error_log -size +5M -exec truncate -s 0 {} \;

Emptying these files does not fix the errors behind them. Read the last lines first (tail -50 error_log) and fix the underlying problem, or the files will grow again.

To clear cache:

  • For LiteSpeed Cache, use Purge All in the WordPress plugin.
  • For other cache plugins, use their own "clear cache" button. You can also delete the contents of folders such as wp-content/cache, but not the folder itself.

Find where your inodes are going

Run this to see which folders contain the most files:

du --inodes -d 1 ~ 2>/dev/null | sort -n | tail -15

Repeat the command inside the biggest folder until you find the culprit. The usual suspects are:

  • Old PHP sessions in ~/tmp.
  • Cache folders.
  • The ~/mail folder.

To remove session files older than 7 days:

find ~/tmp -type f -name 'sess_*' -mtime +7 -delete

3. How do I free disk space on a VPS?

Locate the biggest directories

Start at the root of the filesystem, then repeat inside the largest result (often /var):

sudo du -xh --max-depth=1 / 2>/dev/null | sort -h | tail -15
sudo du -xh --max-depth=1 /var 2>/dev/null | sort -h | tail -15

Shrink the systemd journal and package cache

These commands check the journal size, shrink it to 200 MB, and clear downloaded packages. The last command removes unused packages, including old kernels.

sudo journalctl --disk-usage
sudo journalctl --vacuum-size=200M
sudo apt clean
sudo apt autoremove --purge

apt autoremove keeps the running kernel and one fallback. Check the running kernel with uname -r if you are unsure.

Find and empty large log files

sudo find /var/log -type f -size +100M -exec ls -lh {} \;
sudo truncate -s 0 /var/log/nginx/access.log

Use truncate rather than rm on a log a service is still writing to. Deleting it does not release the space until the service restarts.

Clean up Docker

The first command shows how much space Docker is using. The second removes stopped containers, unused networks, dangling images and build cache. The third also removes all images not used by a container.

docker system df
docker system prune
docker image prune -a
Warning: Do not add --volumes unless you know exactly what each volume holds. On an n8n hosting server, the volume holds your workflows, credentials and execution history. Pruning it while the container is stopped deletes them permanently.

Container logs in /var/lib/docker/containers/ can also grow without limit. To cap them, add the following to /etc/docker/daemon.json, then run sudo systemctl restart docker. The limit applies only to containers created after the change.

{
  "log-driver": "json-file",
  "log-opts": { "max-size": "10m", "max-file": "3" }
}

Purge MySQL binary logs

MySQL 8 keeps binary logs (binlog.000123) for 30 days by default, which can fill /var/lib/mysql. Never delete these files with rm. Purge them from inside MySQL instead:

sudo mysql -e "PURGE BINARY LOGS BEFORE NOW() - INTERVAL 3 DAY;"

To keep only 3 days of logs from now on, set binlog_expire_logs_seconds = 259200 under [mysqld] in /etc/mysql/mysql.conf.d/mysqld.cnf, then restart MySQL. If you use replication, make sure every replica has already read the logs before you purge them.

4. Should I delete files or archive them?

You can safely delete cache, sessions, rotated logs and package caches, because they are rebuilt automatically. Archive anything you might need later, such as old site copies, database dumps and project folders. Compress them, copy them off the server, then remove the originals.

First, on the server, create the archive:

tar -czf old-site-2024.tar.gz old-site/

Next, on your own computer, copy the archive off the server:

scp root@203.0.113.10:/root/old-site-2024.tar.gz .

Finally, once you have confirmed the copy is complete, remove the originals on the server:

rm -rf old-site/ old-site-2024.tar.gz

Check that the archive opens on your computer before deleting the originals. If the disk is completely full, tar may have no room to write. In that case, free a little space first, for example with journalctl --vacuum-size.

5. How do I stop the disk filling up again?

On a VPS, rotate your own application logs with logrotate. Create /etc/logrotate.d/myapp containing:

/var/www/myapp/logs/*.log {
    weekly
    rotate 4
    compress
    missingok
    notifempty
    copytruncate
}

Test the configuration with sudo logrotate -d /etc/logrotate.d/myapp.

For recurring cleanup, use cPanel » Advanced » Cron Jobs on shared hosting, or crontab -e on a VPS. For example, this job removes old sessions every night:

0 3 * * * find $HOME/tmp -type f -name 'sess_*' -mtime +7 -delete

Finally, set up an alert so you hear about the problem at 85% rather than 100%. Our knowledgebase has guides on server monitoring and disk alerts. If your usage keeps growing legitimately, you need a bigger VPS or hosting plan. Plan upgrades are done by opening a support ticket.

Verify it works

  • Run df -h and df -i again. Usage should be well below 90%.
  • On cPanel, reload the home page and check the Disk Usage and File Usage figures. They can take a few minutes to refresh.
  • Upload a test file.
  • Send an email to the mailbox that was bouncing.
  • Check that the site and MySQL respond: sudo systemctl status mysql.

Common problems

I deleted a large file but df still shows the disk full. A running process still holds the file open. List deleted-but-open files with sudo lsof +L1, then restart the service shown, for example sudo systemctl restart nginx. If needed, install the tool first with sudo apt install lsof.

There is free space but I still get "No space left on device". You have run out of inodes. Confirm with df -i, then use du --inodes -d 1 to find the folder with millions of small files. It is usually sessions, cache or a mail queue.

Emails still bounce after freeing account space. Each mailbox has its own quota as well. Raise it in cPanel » Email » Email Accounts » Manage by changing the storage allocation.

MySQL will not start, or I cannot log in over SSH. Free a small amount of space first, for example with journalctl --vacuum-size=100M or by emptying one large log, then start MySQL. If the server is completely unreachable, open a support ticket and ask for rescue mode.

Frequently asked questions

Do JetBackup backups count toward my cPanel disk quota?

No. JetBackup restore points are stored on separate backup storage. Backup files you generate yourself into your home directory, such as backup-*.tar.gz, do count.

Is it safe to run docker system prune on my n8n server?

Yes, as long as the n8n container is running and you do not add --volumes. Your workflows live in a volume, and plain prune leaves volumes alone.

What is the difference between disk space and inodes?

Disk space measures how many bytes you store, while inodes count how many files and folders you have. Either limit can stop your site when it is reached.

Need help? If you cannot find what is filling your disk, or you need rescue mode or a plan upgrade, open a support ticket from your client area and include the output of df -h and df -i.

Was this answer helpful?

0 Users Found This Useful

Powered by WHMCompleteSolution