11 Ways to Free Up Disk Space on a cPanel Server

4.7/5 - (109 votes)

I’m sure that most of you have been to the point where one or more of your servers start to fill up as you get more customers. The server’s performing just fine, but there’s one problem…you’re out of disk space! Here are a few simple tricks to freeing up disk space on your cPanel server to help maximize your server’s potential.

1) Delete user cPanel and Fantastsico backups

If you have the backup feature in cPanel enabled, chances are your users are storing the backups on the server instead of downloading and removing them. On larger servers, this can account for a lot of disk space usage. You may want to consider warning your users ahead of time that backups will automatically be removed from the server after a certain period of time or on certain dates.  You can mass-delete all user cPanel backups on the server with this command:

for user in `/bin/ls -A /var/cpanel/users` ; do rm -fv /home/$user/backup-*$user.tar.gz ; done

To remove Fantastico backups:

rm -rfv /home/*/fantastico_backups

2) Move your backups offsite

Similarly to above, if you’re using the cPanel Backup System and are storing your backups locally on the server, you could be using twice as much space as you need to. Consider mounting a backup server to your hosting server and storing the backups there (there is an option to mount external media in WHM > Configure Backups) or using an alternate method of backing up your server that doesn’t involve storing the backups locally. While local backups may be convenient at times, they tend to be useless when a server failure occurs.

3) Delete cPanel File Manager temp files

When users upload files in File Manager within cPanel, File Manager creates a temp file that may or may not get removed upon upload. You can remove these files using this command:

rm -fv /home/*/tmp/Cpanel_*

4) Move or archive logs

Most of the server’s logs are stored in /var/log, which can get rather large on more populated servers. You can change the length of time and frequency of the log rotation in /etc/logrotate.conf, and enable compression to save additional space (at the expense of CPU when the logs are being gzipped). If you want older logs, consider creating a cron job to periodically transfer them to a backup or log server so they aren’t taking up space on your hosting server.

5) Remove cPanel update archives

Cpanel and EasyApache updates tend to leave behind files that you probably don’t need. The following can be deleted or moved to a backup server to free up a little bit of space:


/home/cpeasyapache (actual name may vary depending on cpanel version)

6) Clean up Yum files

Yum updates leave package cache files on the server. You can clean up all unneeded yum files by running:

yum clean all

7) Remove pure-ftp partials

When your users upload files to the server via FTP when your server runs pureFTP as an FTP daemon, the FTP server creates temporary files starting with .pureftpd-upload* that get renamed the the actual filename when the upload completes. If the upload doesn’t complete, these files are left on the server. You can find and delete these by running:

locate .pureftpd-upload | xargs rm -fv

*If you don’t run an updatedb regularly, you might want to do so before running this command

8) Decrease the reserved disk space

By default, Linux reserves 5% of the disk space from each partition for the root user, so root can still log in even if the disk is full. You may have noticed when running a df that you may be using 900GB out of a 1TB drive, but only have 50GB available…that’s because the other 50GB is reserved.

For larger drives, you really don’t need the whole 5%. I would recommend setting this value down to 2500 blocks so you can utilize more of the disk space. You can do this with tune2fs:

tune2fs -r 2500 /dev/sda1

You’ll want to probably man the tune2fs command before you use it for other options on setting the reserved space for your partitions.

9) Remove unneeded accounts

If you have a larger churn rate you probably have some user accounts laying around on your server that you don’t need. Check out WHM > List Suspended Accounts (or ls /var/cpanel/suspended) and look for suspended accounts that you may be able to remove from the server to free up space. You can terminate accounts in WHM > Terminate an Account or using the command /scripts/killacct <user> <y/n> (y/n indicating whether to save the DNS records)

10) Check for contrabands

As a hosting provider you should have a Terms of Service that specifically tells your customers what they can (or rather cannot) store on your server. Most hosts have specific rules about the hosting of non-website-related backups and copyrighted material, but don’t pro actively scan their servers for it.  It wouldn’t hurt to run a few locate commands to find common files associated with copyright violations, like .mp3, .avi, .exe, etc, and have your customers remove them from the server. I once cleared over 300Gb of space on a server just by having customers remove contraband files from the server. On top of that, you’re also preserving the integrity of your business from a legal standpoint.

11) Consider a larger server

Some of your customers may have a legitimate need for large amount of disk space, and therefore you may be unable to keep the disk space usage on your server at a reasonable level. A lot of hosting providers have alternate servers that are more “low key” but have huge disk storage volumes to accommodate customers that have larger sites. You might want to consider investing in a server that will be less populated and only the users that occupy a large amount of space.


  1. Pingback: Drive Warning: /dev/sda3 (/usr) is 86% full - please help - cPanel Forums

  2. Pingback: 5 Easy Tips to Free Up Disk Space on Your Server | eLief Blog

    1. Vanessa Reply

      Well, if you’re attempting to administer a server and can’t even copy the commands listed in the post, maybe you shouldn’t be doing this anyways 🙂

  3. Ritesh Sanap Reply

    Thanks it did work nicely, and helped me a lot , my whole server was filled and it was bit too much tricky to reduce the space and we cannot delete few stuffs from cpanel if we do not have some disk space

  4. Pingback: Removing WHM Disk Space Errors | IT Admins

  5. Pingback: Removing WHM Disk Space Errors | TurboNoc.com

  6. Pingback: Fixing Quotas on a cPanel Server | TurboNoc.com

    1. Vanessa Reply

      You run this from command line. If you’re not familiar with the unix shell, I would recommend not performing these actions as a root user 🙂

  7. Pingback: Removing WHM Disk Space Errors :: The cPanel Admin

  8. Nishant Reply

    Good guide. But don’t you think it’d be too harsh to bluntly delete all the fantastico / softaculous backups without the permission of the users? They might have something important in there.

    Also, is there any better way to archive the emails to save some space in case the user is consuming like 10GB just for mails?

    1. Vanessa Reply

      This guide is only intended for informational purposes. Whether a system administrator would choose to do this depends on the policies of their company. Many hosts have a ToS clause stating that backups generated by cPanel (including Fantastico/Softaculous) are fair game if they are left on the server too long. Additionally, users should be responsible for maintaining their own offsite website backups.

  9. GoDiva Reply

    Very nice tips. I found out my server was filled up. Looked in the Fantastico file and saw that the file size it has backed up is really huge. That was when i decided to see what others say about deleting these file. I was worried it would have a negative impact. I have saved the file to my computer already. So, i guess i’ll have to delete it and make some space.

  10. Pingback: Pablo Valenzuela » Blog Archive » Liberar espacio en Cpanel

  11. bindiya Reply

    thanks, really helpful post. I was running out of disk space and was not able to upload any media file (pictures) on my wordpress blog. By following these tips, i was able to recover about 400 MB of disk space.

    However one should check the hosting plan, if you have bought unlimited hosting plan, you can always ask for more disk space to your hosting provider.

  12. Gerry Reply

    This post is “timeless”! Found several of these tips to be helpful today..several years later. It pops up near the top of Google results which is a good thing!


  13. Munesh Singh Reply

    I want to know that , If file server shows too many temporary files then how we can fix it.
    I’m a beginner , so need your help.
    Hi Vanessa, i need your help, please suggest something.

    Thanks in advance.

  14. parinda Reply

    Very nice and detailed info. User backups and reserved space, two things I have kept in mind from this post to keep my server somewhat more relaxed. Thanks a lot.

  15. Zabarjad Reply

    dear vanessa
    thank you for usefull post,i just go and want to do command with ssh but there is not option called “connect using java” in my panel ,how can i enable it?

  16. Besik K. Reply

    Thank you for the useful post.
    This bash script might be helpful to combine said above and run all the operations to free up the disk space:

    # Delete error_log files larger then 10MB
    find /home/*/public_html/ -type f -name “error_log” -size +10M -delete
    # Delete Backups stored in /home/user/ folder
    for user in `/bin/ls -A /var/cpanel/users` ; do rm -fv /home/$user/backup-*$user.tar.gz ; done
    # Delete cPanel File Manager temp files
    rm -fv /home/*/tmp/Cpanel_*
    # Remove pure-ftp partials
    locate .pureftpd-upload | xargs rm -fv

    Save these commands into the file under /root/DiskCleanupScripts.sh

    and add cron job in /var/spool/cron/root file:

    40 4 */2 * * /root/DiskCleanupScripts.sh

    So this will run every 2-nd day at 4:40am.

  17. Pingback: How to clear disk space on cPanel server ⋆ SysAdminStuff

  18. Pingback: phpini در سی پنل کجاست

  19. Santiago Gonzalez Reply

    I want to contribute with this… It has helped me to save tons of space with unwanted mails.. It will delete spam, trash and junk mails that were received 24hrs or later.

    find -P /home/*/mail/*/*/.Junk/* -mindepth 1 -maxdepth 1 -mtime ‘+1’ -delete
    find -P /home/*/mail/*/*/.Spam/* -mindepth 1 -maxdepth 1 -mtime ‘+1’ -delete
    find -P /home/*/mail/*/*/.Trash/* -mindepth 1 -maxdepth 1 -mtime ‘+1’ -delete

    Carefull.. if you need to keep trash mails dont run the last command.

  20. Rajat Shankhdhar Reply

    I have a Question, Can u Help me!

    I am using Freehosting with 10GB storage space, suddenly I got an error when I was trying to upload an image. When I checked hosting File manager, my public_html directory is full of the only 240mb memory usage.

    What should I do now? Please help me… I am new to WordPress and Hosting kinds of stuff.

    Thank you!

  21. Pingback: Top Performing Cpanel Hosting Reddit | Web Hosting

  22. Pingback: Top Performing Whm Reddit | Web Hosting

  23. robrt smith Reply

    well explained, and helped me tons , my whole server was filled and it had been bit an excessive amount of tricky to scale back the space and that we cannot delete few stuffs from cpanel if we don’t have some disc space

Leave a Reply

Your email address will not be published. Required fields are marked *

Log in