Some Steps to Reduce Disk Space on cPanel Server (For VPS/Cloud Clients Only)
By manoj on August 17th, 2018
1) In most of the cases, the backup stored in the server causes this heavy disk space usage. Most of the cPanel users will store their backups in server itself instead of downloading it to their local machine. You can simply delete your backups from the server using the below script.
# for user in `/bin/ls -A /var/cpanel/users` ; do rm -fv /home/$user/backup-*$user.tar.gz ; done
2) Instead of deleting the backup from the server you can move the backup to another server.
You can just move the backup file to another server using commands scp or rsync. Also, you can configure backup in WHM by following the below steps.
- a) Login to WHM.
- b) Navigate to “Backup Configuration” under Backup section.
- c) Click on “Enable” radio button then click on “Create new destination” button.
- d) Last you need to fill the destination server details and click “Save Destination” button.
- e) Finally, you need to click “Save Configuration” button to save all changes.
3) Another way to clean up the disk space is simply to delete the temporary files. During uploading files via File Manager, cPanel creates a copy of those files in the tmp folder. You can delete those files using the below command.
# rm -fv /home/*/tmp/Cpanel_*
4) Removing package manager files. All file that does not need for YUM repository will clean after running the below command.
# yum clean all
5) Delete some temporary file that creates when there is an upload fail occur via FTP uploads.
That is when a user tried to upload files to the server, due to some reason an upload fail may occur. Then FTP daemon create a temporary file. You can delete the same from the below commands.
# locate .pureftpd-upload | xargs rm -fv
6) You can also remove unused cPanel from WHM. It will also help you to reduce the disk usage. It can be done by following the steps.
1) Login to WHM.
2) Navigate to “Terminate Accounts” From “Account Functions” section.
3) Then you can choose that unwanted account and click on “Remove” button.
Or you can do the same from the command line by running the below command.
# /scripts/killacct <user>
7) Also some cases log file will consume large disk space. Most of the log files are stored in the location /var/log. Their size and frequency of rotation may be adjusted by /etc/logrotate.conf file. You can also enable Log Rotation from your WHM.
1) Login to WHM.
2) Navigate to “Apache Configuration” under “Service Configuration”.
3) Click on “Log Rotation”.
4) Add check mark for access_log and error_log.
5) Click “Save” button.
If you need any further help please do reach our support department.