Skip to content
Back to Blog
Hosting Support10 min read

How to Free Up Disk Space on a cPanel Account

Learn how to identify what's consuming disk space in your cPanel account and safely clean email, logs, backups, cache, and other space-hogging files.

Written by Abdul AbrorTechnical Hosting Support Engineer
How to Free Up Disk Space on a cPanel Account
On this page

Running out of disk space on a cPanel account can bring your site to a halt. Email stops working, backups fail, and WordPress refuses to update. The good news is that most cPanel accounts fill up for predictable reasons, and you can reclaim space quickly once you know where to look.

This guide walks you through identifying what's consuming your quota and safely cleaning each category without breaking your site.

Understanding cPanel Disk Usage

Before you start deleting files, check your current usage. Log into cPanel and look at the Disk Usage meter on the main dashboard. Click through to the full Disk Usage tool to see a breakdown by directory.

The report shows your home directory structure and sorts folders by size. Pay attention to these common culprits:

  • mail/ – Email messages and attachments
  • public_html/ – Your website files, including uploads and cache
  • logs/ – Access and error logs
  • backups/ or .snapshot/ – Old backup files
  • tmp/ – Temporary files and session data

Most shared hosting plans also enforce an inode limit alongside disk space quotas. Every file and folder counts as one inode. Even if you have gigabytes of space left, hitting the inode limit prevents new file creation. Check your inode count in the cPanel sidebar or the account statistics area.

Cleaning Email Storage

Email is the number one disk space consumer on most cPanel accounts. A single account with years of history and large attachments can eat gigabytes.

Find Large Mailboxes

In cPanel, open Email Accounts. The interface displays disk usage next to each account. Sort by usage to identify the worst offenders.

For command-line access, SSH into your account and run:

du -sh ~/mail/*/*/cur ~/mail/*/*/new | sort -h

This shows the size of each mailbox folder.

Delete Old Messages

Log into webmail (Roundcube or Horde) for the account in question. Create a filter or manually delete:

  • Messages older than a specific date
  • Spam and trash folders (these often go unnoticed)
  • Large attachments you've already downloaded

Empty the Trash and Junk folders completely. Many users forget that deleted messages still consume space until the trash is emptied.

Archive or Download

If you need to preserve old email but free up server space:

  1. Use an email client like Thunderbird or Outlook to download messages via IMAP
  2. Move them to local folders
  3. Delete the server copies
  4. Empty trash on the server

Alternatively, configure your email client to automatically delete messages from the server after downloading them via POP3, though this prevents access from multiple devices.

Adjust Mailbox Quotas

In Email Accounts, set individual quotas to prevent mailboxes from growing indefinitely. A quota of 250-500 MB per mailbox is reasonable for most users and forces regular cleanup.

Clearing Access and Error Logs

Web server logs grow continuously and rarely get cleaned automatically on shared hosting.

Check Log Size

Logs live in ~/logs/ or sometimes ~/public_html/logs/. Check their size:

du -sh ~/logs/

Access logs for busy sites can reach several gigabytes. Error logs typically stay smaller unless your site has ongoing issues.

Safely Truncate Logs

You can safely empty log files without deleting them:

cd ~/logs/
truncate -s 0 *.log

Or via File Manager in cPanel:

  1. Navigate to the logs/ directory
  2. Select large .log files
  3. Edit each file and delete all content
  4. Save the empty file

Never delete the log files themselves—the web server expects them to exist. Truncating (emptying) is safe and immediate.

Archive Before Clearing

If you need logs for analysis, download them first:

tar -czf logs-backup-$(date +%F).tar.gz ~/logs/*.log
mv logs-backup-*.tar.gz ~/backups/

Then truncate the originals.

Removing Old Backups

cPanel's backup wizard and automated backup tools often save archives directly to your home directory, consuming massive amounts of space.

Locate Backup Files

Common locations:

  • ~/backups/
  • ~/public_html/backups/
  • Root of your home directory (look for backup-*.tar.gz)

Use File Manager or SSH:

find ~/ -name "backup-*.tar.gz" -o -name "*.sql.gz" | xargs du -sh

Delete Outdated Backups

Keep only your most recent backup on the server. Download older backups to your local machine or offsite storage, then delete them from cPanel:

rm ~/backups/backup-2025-*.tar.gz

If you use cPanel's backup wizard regularly, consider configuring it to send backups directly to remote FTP/S3 storage instead of saving locally.

Disable Automatic Local Backups

Some cPanel accounts have JetBackup or similar tools that store snapshots in .snapshot/ directories. These are usually managed by your host and may not be deletable by you. Contact support to adjust retention policies if snapshots consume too much quota.

Cleaning WordPress and Application Cache

If you run WordPress, Joomla, Drupal, or other CMS platforms, cache and temporary files accumulate quickly.

WordPress Cache and Uploads

Common WordPress space hogs:

  • wp-content/cache/ – Page cache from plugins like W3 Total Cache or WP Super Cache
  • wp-content/uploads/ – Media library, including unused images and old file versions
  • wp-content/upgrade/ – Leftover plugin and theme update files
  • wp-content/ai1wm-backups/ – All-in-One WP Migration plugin backups

Clear Cache Safely

If you use a caching plugin, clear cache from the WordPress admin dashboard first. Then verify the cache directory is empty:

du -sh ~/public_html/wp-content/cache/
rm -rf ~/public_html/wp-content/cache/*

Remove Old Uploads

Install the Media Cleaner plugin to identify unused images and files in your media library. Review the list carefully before deleting—some themes reference images in non-standard ways.

For manual cleanup:

find ~/public_html/wp-content/uploads/ -type f -mtime +365 -size +5M

This lists files larger than 5 MB that haven't been modified in over a year. Review before deleting.

Clean Update and Backup Directories

rm -rf ~/public_html/wp-content/upgrade/*
rm -rf ~/public_html/wp-content/ai1wm-backups/*

Be aggressive with these directories—they're temporary by design.

Other CMS Platforms

  • Joomla: Check cache/, tmp/, and logs/
  • Drupal: Look in sites/default/files/css/, sites/default/files/js/, and sites/default/files/backup_migrate/
  • Magento: Clear var/cache/, var/session/, and var/log/

Consult your application's documentation for safe cache-clearing procedures.

Clearing Session and Temporary Files

PHP applications store session data and temporary uploads in predictable locations.

Check tmp Directories

du -sh ~/tmp/ ~/.tmp/
find ~/tmp/ -type f -mtime +7 -delete

This removes files older than seven days. Session files older than a week are almost certainly abandoned.

PHP Upload Temp Directory

Some applications leave failed uploads in the PHP temp directory. If you have shell access:

find /tmp -user $(whoami) -type f -mtime +1 -delete

Shared hosting accounts usually have automatic cleanup for /tmp, but your home directory's tmp/ folder may not.

Managing Inode Limits

If you've freed disk space but still can't create files, you've likely hit your inode limit. Each file and directory counts as one inode, regardless of size.

Identify Inode-Heavy Directories

Run this to find directories with the most files:

find ~/ -type d -exec sh -c 'echo "$(find "{}" -maxdepth 1 | wc -l) {}"' \; | sort -n | tail -20

Common inode hogs:

  • Email accounts with tens of thousands of individual messages
  • Cache directories with thousands of small files
  • Session directories
  • Version control repositories (.git/ directories)

Reduce File Count

Prioritize cleaning:

  1. Email: Delete thousands of old spam and trash messages
  2. Cache: Clear application cache directories
  3. Sessions: Remove old session files from tmp/
  4. Version control: If you have Git repositories, consider removing old branches or the entire .git/ history for sites in production

For email, a single mailbox with 50,000 messages might use only 500 MB of space but consume 50,000 inodes. Deleting old messages frees both.

Preventing Future Space Issues

Set Up Email Retention Policies

Configure email accounts to automatically delete messages older than a certain period. While cPanel doesn't have built-in retention policies, you can:

  • Use email client filters to auto-delete old messages
  • Set up server-side filtering with custom scripts (requires shell access)
  • Educate users to clean their mailboxes quarterly

Rotate Logs Automatically

If you have SSH access and cron privileges, set up log rotation:

crontab -e

Add:

0 2 1 * * find ~/logs/ -name "*.log" -mtime +30 -exec truncate -s 0 {} \;

This truncates logs older than 30 days at 2 AM on the first of each month.

Optimize WordPress Media

Use plugins like ShortPixel or Imagify to compress images on upload. Enable lazy loading to defer offscreen images. Consider offloading media to a CDN or object storage to keep it off your cPanel quota entirely.

Disable Unnecessary Backups

If your host provides automatic backups, disable local backup plugins. Storing multiple backup copies on the same server wastes space and doesn't protect against hardware failure.

Monitor Disk Usage

Set up alerts for disk usage thresholds. Many hosts offer email notifications when you reach 80% or 90% of quota. Enable these in your hosting control panel or contact support to request monitoring.

Checklist: Quick Disk Space Recovery

Use this checklist when you need to free space immediately:

  • [ ] Check cPanel Disk Usage report to identify large directories
  • [ ] Log into webmail and empty Trash and Junk folders for all accounts
  • [ ] Delete old messages or set up mail client to archive locally
  • [ ] Truncate log files in ~/logs/
  • [ ] Remove old backup archives from ~/backups/ and home directory
  • [ ] Clear WordPress cache directories and unused media
  • [ ] Delete temporary files in ~/tmp/
  • [ ] Remove old plugin/theme update files
  • [ ] Check inode count and clean email if over limit
  • [ ] Set mailbox quotas and disable local backups going forward

Conclusion

Most cPanel disk space issues trace back to unchecked email growth, forgotten log files, and redundant backups. By systematically checking each category and implementing a few preventive measures, you can reclaim gigabytes of quota and avoid future emergencies. Start with email and logs—those two alone often account for the majority of wasted space. Set quotas, automate cleanup where possible, and keep only what you need on the server.

FAQ

Why does cPanel show I'm using more space than I see in File Manager?

File Manager only shows your public_html/ directory by default. Click Home Directory in File Manager to see your entire account, including mail/, logs/, and hidden directories that consume quota.

Can I safely delete .trash folders?

Yes, but they're usually empty. Email trash lives in mail/[domain]/[account]/.Trash/. Delete the contents, not the folder itself, to avoid breaking email clients.

Will truncating logs break my site?

No. Truncating (emptying) log files is safe and immediate. The web server continues writing new entries. Never delete the log files themselves—empty them instead.

My host says I'm over quota but I can't find the files. What now?

Contact support. You may have snapshot backups, system files, or database storage that doesn't appear in standard file listings. Some hosts count database size against disk quota.

How often should I clean my cPanel account?

Review disk usage monthly. Set up automated cleanup for logs and temporary files quarterly. Archive or delete old email at least twice a year.