How to reduce disk space on a cPanel server (for VPS/Cloud clients only)
20 Mar 2014 05:14 AM
1. Delete users backups.
There are many users that store their backup on the server instead of downloading the to their local machine, this may cause server to run out of space really quickly. In order to delete all users' backups the following command may be used:
for user in `/bin/ls -A /var/cpanel/users` ; do rm -fv /home/$user/backup-*$user.tar.gz ; done
2. Moving backups to another server.
Another good idea about reducing space on cPanel server is to store backups to different machine which is designated only for this purpose. WHM panel may be set to use another server (WHM > Configure Backups).
3. Deleting Temporary Files.
During uploading files through file manager cPanel keeps a copy of it. It's temporary file, it may be removed by using following command:
rm -fv /home/*/tmp/Cpanel_*
4. Getting rid of log files.
Most of log files are being kept in /var/log directory, they may get quite large in busy servers. Their size and frequency of rotation may be adjusted by /etc/logrotate.conf file. Another way to cope with large log files is to gzip them, cron job may be created to execute this job.
5. Deleting cPanel updates.
Sometimes during updates cPanel leaves some unnecessary files,they may be removed by :
/home/cpeasyapache (actual name may vary depending on cPanel version)
6. Removing package manager files.
All files that are not need by YUM may be removed by:
yum clean all
7. Deleting Temporary files.
When some user uploads file to FTP server by using pure-ftp as FTP daemon, it creates temporary files in case upload process fails. They may be removed by following command:
locate .pureftpd-upload | xargs rm -fv
8. Reducing the reserved space by disk.
Linux is reserving 5% of disk space for root user, this amount of space may be adjusted.
tune2fs -r 2500 /dev/sda1
9. Removing unused accounts.
If there are many unused accounts on server, by removing them it may free up some space. There are two ways to do same thing either WHM > Terminate an Account or /scripts/killacct <user> <y/n>
10. Checking for files violating our Terms & Conditions.
If user's account contains files that are infringement of Terms & Conditions, for example .mp3,.avi,.iso..etc. they may be removed.