When you run out of disk space, you might experience downtime, slow website loading, or emails that get sent but dose not arrive in your mailbox. You can follow below cPanel tips to free your disk sapce and maximize your server’s potential.
1. cPanel clean up disk space
Initially, You need to check whether the backup feature in cPanel is enabled or not. It will take plenty of your disk space usage, If you have got larger servers, as your users might have stored the backups on the server instead of downloading and removing them. By using the below command you can delete all user cPanel backups on the server.
for user in `/bin/ls -A /var/cpanel/users` ; do rm -fv /home/$user/backup-*$user.tar.gz ; done
Similarly, 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. Hence you can mount a backup server to your hosting server and store the backups there.
2. Delete cPanel File Manager temp files
You can remove the user uploaded files in File Manager within cPanel, as it creates a temp file that might not get removed upon upload.
rm -fv /home/*/tmp/Cpanel_*
3. Move or archive logs
Most of the server’s logs are stored in /var/log, which will populate your servers. Moreover, you can change the length of time and frequency of the log rotation in /etc/logrotate.conf and also enable compression to save additional space.
4. Remove cPanel update archives
You can delete or move /usr/local/apache.backup*
/home/cpeasyapache (actual name might vary based on cpanel version)
to a backup server to free little bit of space, as Cpanel and EasyApache updates leave behind files that are required.
5. Clean up Yum files
You can clean up all unwanted yum files by running a simple command, as yum updates leave package cache files on the server.
yum clean all
6. Remove pure-ftp partials
You need to find and delete your users uploaded files to the server via FTP when your server runs pure FTP as an FTP daemon. Next, the FTP server creates temporary files starting with .pureftpd-upload* that rename the actual filename when the upload is complete.
locate .pureftpd-upload | xargs rm –fv
7. Decrease the reserved disk space
You might have noticed that while checking the disk space. For example you might be using 900GB out of a 1TB drive, but it shows only 50GB available. This is because the other 50GB is reserved.
Such as for a large drives you really don’t need the whole 5%. Hence the best is to set this value to 2500 blocks and you can utilize more disk space. You can simply follow the below command.
tune2fs -r 2500 /dev/sda1
Note: You need to add the main command on the tune2fs command before you use it. This shows other options for setting the reserved space for your partitions.