Knowledgebase

How to find large files and free up disk space on a Linux server

This guide shows you how to find large files and free disk space on Linux when your VPS or dedicated server is full. A full disk can stop email, break databases and take websites offline, so it is worth checking quickly and safely.

Warning: deleting files with rm is permanent. Never delete system folders, database files in /var/lib/mysql, or anything you do not recognise. When in doubt, move the file to a backup location or ask support first.

Step 1: See which partition is full

df -h
df -i

Note which mount point (/, /home, /backup) is near 100%. If df -i shows 100% inodes, the problem is too many small files, not big ones.

Step 2: Find the biggest folders

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

This lists the biggest top-level folders on that partition. Run it again on the largest one, for example /home or /var, to drill down.

For an easier interactive view, use ncdu (from EPEL):

dnf install -y epel-release
dnf install -y ncdu
ncdu -x /

Use the arrow keys to browse. ncdu can delete with d, so be careful.

Step 3: Find individual large files

find / -xdev -type f -size +500M -exec ls -lh {} \; 2>/dev/null

This lists files larger than 500 MB. Change the size to +100M for a wider search.

Usual suspects on a cPanel server

WhatWhereWhat to do
Old account backups/backup, /home/*/backup-*.tar.gzLower retention in WHM > Backup Configuration; move old ones off the server
Migration files/home/cpmove-*Delete after a successful transfer
Huge PHP error logserror_log files in site foldersFix the error, then empty the file
System logs and journal/var/logjournalctl --vacuum-size=200M
Package cache/var/cache/dnfdnf clean all
Full mailboxes and trash/home/*/mailAsk users to empty Trash/Spam or set quotas
Plugin backups and cachewp-content backup and cache foldersKeep backups off the server, clear old cache

To empty a log file safely without deleting it (the service keeps writing to it):

truncate -s 0 /home/user/public_html/error_log

Step 4: Space not freed after deleting?

If a running process still has a deleted file open, the space is not released. Find such files with:

lsof +L1 2>/dev/null | head

Restart the service that holds them (for example the web server), and the space comes back.

Prevent it next time

Frequently asked questions

Can I delete files in /tmp?

Old files there are usually safe to delete, but running services may be using recent ones. Avoid deleting while a backup or update runs.

Can I add more disk space instead?

Yes. Contact EgWeb support about upgrading your VPS storage or adding a disk.

Need help? Open a support ticket or message us on WhatsApp +20 127 113 3655.

  • disk space, disk full, du, find large files, ncdu, linux, cpanel, cleanup

Was this answer helpful?

0 Users Found This Useful