Home/Blog/CyberPanel disk full

CyberPanel disk full: how to find what's eating space and clean it safely

Updated October 28, 2026By Dr. S8 min read

A full disk is the most common root cause behind "random" failures on a VPS: MariaDB refuses writes, OpenLiteSpeed cannot create its PID file, a package update writes a corrupt binary, the panel's Python venv breaks. It is also the easiest problem to make worse with a reckless rm -rf. Here is the careful way.

Space or inodes?

df -h /
df -i /

Two different problems. Out of space means big files. Out of inodes with space left means millions of tiny files, usually PHP sessions, mail queue items, cache fragments or a runaway log directory. For inodes, du will mislead you; count files instead:

for d in /var /home /tmp /usr/local/lsws /usr/local/CyberCP; do printf "%-24s " $d; find $d -xdev -type f 2>/dev/null | wc -l; done

Find what is using it

du -xh --max-depth=2 / 2>/dev/null | sort -rh | head -20
find / -xdev -type f -size +200M -printf "%s %p\n" 2>/dev/null | sort -rn | head -20

On CyberPanel servers the usual suspects, in order:

Deleted files that still take space

If you already deleted something and df did not move, a process is still holding the file open:

lsof -nP +L1 | awk 'NR>1{print $1, $7, $9}' | sort -k2 -rn | head

Restart the owning service to release the blocks: systemctl restart rsyslog for syslog, systemctl restart lsws for web logs. Avoid restarting MariaDB for this unless you have to; truncate its log instead. This is also why the rest of this guide truncates live logs rather than deleting them.

Safe to clean in one go

These do not touch your sites, databases or configuration and can be run together:

# systemd journal: keep 7 days / 200 MB
journalctl --vacuum-time=7d --vacuum-size=200M

# package manager cache
apt-get clean            # Ubuntu
dnf clean all            # AlmaLinux / Rocky

# rotated/archived logs older than 7 days
find /var/log /usr/local/lsws/logs /home/*/logs -type f \
  \( -name "*.gz" -o -name "*.[0-9]" -o -name "*.old" \) -mtime +7 -delete

# large ACTIVE logs: empty them, do not delete them
find /var/log /usr/local/lsws/logs /home/*/logs -type f -name "*.log" -size +100M \
  -exec truncate -s 0 {} \;

# temp files older than a week
find /tmp /var/tmp -xdev -type f -atime +7 -delete

# pip cache (system and the panel venv)
rm -rf /root/.cache/pip; /usr/local/CyberCP/bin/pip cache purge 2>/dev/null

# OpenLiteSpeed / LSCache page cache (rebuilt automatically)
find /usr/local/lsws/cachedata /home/*/lscache -mindepth 1 -delete 2>/dev/null
chown -R nobody:nogroup /usr/local/lsws/cachedata   # AlmaLinux: nobody:nobody

# core dumps
rm -f /core.* /var/lib/systemd/coredump/* 2>/dev/null

Then stop the journal and logs from growing back:

sed -i 's/^#\?SystemMaxUse=.*/SystemMaxUse=200M/' /etc/systemd/journald.conf
systemctl restart systemd-journald

and check that logrotate covers /usr/local/lsws/logs and /home/*/logs; CyberPanel ships a rotation config, but hand-added vhosts sometimes miss it.

MariaDB binary logs

If /var/lib/mysql/mysql-bin.* is large and you are not using replication, purge from inside MariaDB, never with rm:

mysql -e "PURGE BINARY LOGS BEFORE NOW() - INTERVAL 3 DAY;"
# and cap them: expire_logs_days=3 (or binlog_expire_logs_seconds) in the MariaDB config

Clean only with confirmation

These free a lot of space but each one deserves a look first.

Never touch

After cleaning, re-run df -h / and df -i /, then restart whatever was failing because of the full disk. If something was reinstalled while the disk was full, consider reinstalling it again now that there is room, since the earlier copy may be corrupt.

Dr. S

Self-taught developer and SEO specialist who runs CyberPanel and OpenLiteSpeed servers for his own SaaS tools and client sites. VPS Medic is built from the repairs he kept doing by hand on those servers.

One tap, same rules

VPS Medic's disk cleanup shows every item with its estimated size, runs the safe ones together, asks before the risky ones, and refuses the ones above. It also detects deleted-but-open files and restarts only the services that are safe to restart.

Download VPS Medic — free 3-day trial