Update, 9 October 2026: the clean-up block no longer calls a blanket /tmp and /var/tmp delete safe. It now lists old temporary files for review, and the MySQL privilege and Mailman commands are gone. Found in an independent review.
Applies to cPanel & WHM on AlmaLinux 8/9 and CloudLinux 8/9 (dnf-based) with EasyApache 4 and cPanel's Exim; the dnf steps do not apply to Ubuntu
Short answer: A cPanel disk full problem is usually oversized logs, local backups in /backup, a large Exim queue or old mail, and sometimes exhausted inodes rather than bytes. Find the filesystem and directory first, for example with du -xh --max-depth=1 / 2>/dev/null | sort -rh | head -15, alongside df -h and df -i. Then truncate logs instead of deleting open files, lower backup retention, remove spam from the queue, clear package caches, and restart MariaDB and Exim once space is back. (Reviewed October 2026.)
A full root or /home partition on a cPanel server breaks things in cascading order: MariaDB stops accepting writes, Exim freezes the queue, sessions cannot be written so logins fail, and eventually cpsrvd itself refuses to start. Reclaiming space fast matters, but so does not deleting the wrong thing while in a hurry. The steps below are ordered from safest and fastest to more involved, and they finish with finding the growth so it does not recur next week.
Table of Contents
Find where the space went
Do not start deleting until you know which filesystem is full and what is on it:
df -h
df -i
du -xh --max-depth=1 / 2>/dev/null | sort -rh | head -15
df -i matters because a partition can be “full” with free bytes if inodes are exhausted; millions of small session or cache files do that. The -x flag on du keeps it on one filesystem so /home does not distort the root figures. On most cPanel servers the answers are one of /var/log, /backup, /var/spool/exim, /usr/local/cpanel/logs, /var/cache, /home/*/mail, or a single account’s public_html.
For a per-account view, our cPanel disk usage report script is faster than du across /home, and whmapi1 listaccts | grep -E 'user|diskused' gives a quick sorted list.
Logs: the fastest win
Logs are safe to truncate, never rm them while a process holds the file open. The usual suspects on cPanel:
du -sh /var/log/* /etc/apache2/logs/* /usr/local/cpanel/logs/* 2>/dev/null | sort -rh | head
: > /var/log/messages
: > /etc/apache2/logs/error_log
: > /usr/local/cpanel/logs/error_log
A multi-gigabyte Apache error_log is a site emitting PHP warnings thousands of times a second; truncate it, then find the site in the last lines before you do so. A large /var/log/maillog or exim_mainlog is an outbound mail problem; a large /var/log/lfd.log is CSF being chatty about a port scan. For domlogs, see the web log retention guide for the permanent fix; for right now, truncate the largest with : > /etc/apache2/logs/domlogs/example.com.
Also check journald, which is capped by default but not always:
journalctl --disk-usage
journalctl --vacuum-size=200M
Backups on the same disk
/backup (the default cPanel backup directory) on the root or /home filesystem is the most common reason a server fills up predictably at 01:00. Inspect what is kept:
du -sh /backup/* /backup/*/* 2>/dev/null | sort -rh | head
ls /backup/daily /backup/weekly /backup/monthly 2>/dev/null
If the retention in WHM » Backup Configuration is more than the disk can hold, reduce it and let the next run prune, or delete the oldest dated directory manually. Remove only complete dated directories, never individual account archives inside a set, or the restore interface shows partial results. If backups are also going to a remote destination and the local copy is not required, set “Retain backups in the default backup directory” off. Legacy /backup/cpbackup/ from the old backup system can be removed entirely if the new system has been in use for a while.
The Exim queue and mail
A queue with tens of thousands of messages is both a disk and a reputation problem:
exim -bpc
du -sh /var/spool/exim/input
If it is a spam run, identify the source first (the outgoing spam guide and the Exim queue report script do this), then purge messages from that sender:
exiqgrep -i -f 'compromised@example.com' | xargs -r exim -Mrm
Frozen bounces to nonexistent addresses can be dropped wholesale with exiqgrep -z -i -f '^<>$' | xargs -r exim -Mrm.
Mailbox growth is a slower burn: du -sh /home/*/mail | sort -rh | head shows accounts with years of unread mail in .Trash or .spam. cPanel can auto-purge those folders server-wide with Auto Expunge Trash and Auto Expunge Spam (and their expire times) in WHM » Service Configuration » Mailserver Configuration; both are disabled by default.
cPanel caches, package caches and temp
Package caches are safe to clear; the package manager downloads what it needs again:
dnf clean all
Temporary folders are different. An old modification time does not mean a file is unused: PHP sessions, lock files, application caches and files a running process still holds open can all be older than a week. Look first, then delete only what you have identified:
du -xh --max-depth=2 /tmp /var/tmp 2>/dev/null | sort -h | tail -20
find /tmp /var/tmp -xdev -type f -mtime +7 -printf '%TY-%Tm-%Td %u %s %p\n' | sort | tail -50
lsof +L1 2>/dev/null | head -20
The find line only lists files; it deletes nothing. On our cPanel 138 lab server it showed fstrim.lck lock files in both folders, which is exactly the kind of file an age-based purge removes by mistake. lsof +L1 shows deleted files that a process still holds open; their space comes back only when that service restarts, so deleting more files will not help. Delete by owner and path once you know what created the files, and run the same find without -delete first to preview. For PHP sessions use cPanel’s own /scripts/clean_user_php_sessions, which root’s cron already runs. On systemd servers /tmp and /var/tmp are cleaned by systemd-tmpfiles; systemd-tmpfiles --cat-config shows its rules. Change those rules rather than adding a blanket purge.
Earlier versions of this guide also listed a MySQL privilege clean-up, a Mailman archive database delete and find /tmp /var/tmp -type f -mtime +7 -delete as safe. They are not general disk cleanup, and the last one can delete files that are still needed, so they have been removed. /var/cpanel/updatelogs and /usr/local/cpanel/logs/cpbackup accumulate one log per run; keep a month and delete the rest. The EasyApache 4 profile and RPM caches under /var/cache/ and old kernels (dnf remove --oldinstallonly) recover a surprising amount on long-lived servers. Be careful with /var/cpanel/version and /var/cpanel/users; they look like caches and are not.
Inodes exhausted
If df -i shows 100%, find the directory with the file storm:
find / -xdev -type d -size +1M 2>/dev/null | head
find /home -xdev -type d -size +2M 2>/dev/null
A directory whose entry is over a megabyte contains tens of thousands of files. Typical sources are PHP session directories, a cache plugin writing per-URL files, .spam folders, and compromised sites dropping thousands of doorway pages. Clear the cache or session directory and tell the customer; a doorway-page dump means the account needs a malware scan before anything else.
A common pitfall: space that does not come back after deleting a file is being held by a running process. List them and restart the owner, or truncate via the file descriptor:
lsof +L1 | head
: > /proc/PID/fd/FD
Verify and keep it running
Confirm with df -h and df -i, then restart anything that was blocked: /scripts/restartsrv_mysql, /scripts/restartsrv_exim, and check systemctl --failed. Set the disk alert to 85% in WHM » Server Configuration » Tweak Settings (Notifications tab: Account system disk usage “warn” percentage, default 82.55%, with System disk space usage warnings On), check in WHM » Contact Manager that Disk Usage Warnings reach you, add the same threshold to your external monitoring, put /backup on its own volume or a remote destination, and schedule the disk usage report weekly so account growth is a ticket rather than an outage.
Official documentation (checked 9 October 2026): Backup Configuration (WHM documentation) · Exim specification: Exim utilities (exiqgrep) · Exim specification: The Exim command line · Exim specification: message identification · Mailserver Configuration (WHM documentation) · Tweak Settings – Notifications (WHM documentation) · How to configure disk usage alerts (cPanel Support) · Contact Manager (WHM documentation) · Advanced Apache Configuration – The paths.conf File (cPanel docs) · journalctl(1) – Linux manual page · The restartsrv Script (WHM documentation)
Related guides: “cPanel license is invalid”: troubleshooting manage2, IP changes and firewalls · cPanel 2026 pricing and licensing explained: Solo, Admin, Pro, Premier and WP Squared · Account quotas show “unlimited”: fixquotas and XFS/ext4 quota repair on cPanel.
See also: /tmp Full on cPanel: Find What Fills It and Clean Up Safely
Frequently asked questions
Does truncating Apache and Exim logs on cPanel break anything?
No. Truncating with : > file keeps the file and its open descriptor intact, so Apache and Exim carry on writing; deleting the file instead would hold the space until the process restarts and leave the daemon logging to nowhere.
How long does cleaning up a full cPanel disk take?
Log truncation and cache clearing free space within a minute or two; pruning backups and purging a large Exim queue take longer, typically ten to thirty minutes, and locating the account responsible for the growth is the part that deserves the rest of the hour.
Can I undo this?
Truncated logs and purged queue messages cannot be recovered, and deleted backup sets are gone unless a remote copy exists, so keep the last lines of any large error log before truncating and delete only the oldest complete backup directories.
Maintenance record
This guide changes servers, data or security settings, so we re-check it against current versions on a fixed schedule. Take a backup or snapshot before you start.
- Maintained by
- srvScripts editorial team
- Supported versions
- cPanel & WHM on AlmaLinux 8/9 and CloudLinux 8/9 (dnf-based) with EasyApache 4 and cPanel's Exim; the dnf steps do not apply to Ubuntu
- Last full review
- Next review
- Sources
- docs.cpanel.net/whm/backup/backup-configuration
exim.org/exim-html-current/doc/html/spec_html/ch-exim_utilities.html
exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html
exim.org/exim-html-current/doc/html/spec_html/ch-how_exim_receives_and_delivers_mail.html#SECTmessiden
docs.cpanel.net/whm/service-configuration/mailserver-configuration
docs.cpanel.net/whm/server-configuration/tweak-settings/notifications
