Different Ways To Free Up Disk Space On Cpanel Server

Getting consumers is beneficial to any business, but we all know that it comes with its own set of problems. Your server fills up as a result of the increased number of customers, and you begin to run out of disc space. The only method to improve your server’s potential and efficiency is to expand its disc space.

Some of the following steps regarding to Cpanel are as follows:

1. Delete cPanel and Fantastico backups for each user:

The main cause of a substantial portion of the server’s disc space running out is when users begin making backups on the server rather than deleting them after a download. This will very certainly be the case if you have the backup feature enabled in Cpanel.
Using the following command, you can erase all of a user’s cPanel backups:

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

Use the following command to erase all Fantastico backups:

rm -rfv /home/*/fantastico_backups

2. Transfer your backups to a backup server:

Another important reason is to keep your hosting server’s backup files on the server itself. Many individuals do this because they believe it will be beneficial in the long term, but we all know how ineffective it is when a server fails. You waste a lot of disc space unnecessarily by doing so. It would be preferable if you could attach a backup server to your hosting server and save your backup data there.
You can apply the following strategies:

  • Use the WHM > Configure Backups option to mount external media if it’s available on the server.
  • Any other way for backing up your files that does not require them to be stored locally.

3. Delete the temporary files created by cPanel File Manager:

File Manager creates a temporary file that may or may not be deleted depending on the upload.

Using the following command, you can delete all transient files:

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

4. Move or archive logs:

The majority of servers have big log files that take up a lot of disc space.

  • The log files can be found in /var/log.
  • In configuration file, you can adjust the frequency and length of your logs to meet your needs, as well as enable compression (This will compress the files and reduce the space taken by these files)
  • You can also transfer these server files to a backup or log server on a regular basis.

5. Cleaning Yum files:

Package cache files are left on the server every time you update yum.

To clean up yum files, run the following commands:

yum clean all

6. Remove cPanel update archives:

Unwanted files can be left behind by cPanel and Apache update archives.
You can use the following commands to delete these files and free up some space:

 /usr/local/apache.backup*

7. Remove pure-ftp partials:

When your users upload files to your server using pureFTP as an FTP daemon, the FTP server creates temporary files with the extension.pureftpd-upload*. When the upload is complete, their files are renamed to the actual filename, leaving such files on the server if the upload is incomplete.
You can use the following commands to delete these files:

locate .pureftpd-upload | xargs rm -fv

8. Decrease the reserved disk space:

When you run a df on the server, you obviously realize that you only have 50GB left on your 1TB drive after only using 900GB. Where did the other 50GB go? By default, Linux reserves 5% of each partition’s storage space for the root user, allowing the root user to log in even if the disc is full.
You don’t have to allocate 5% of your disk space if you have a larger drive; you can reduce this amount to 2500 blocks and free up more space on your server.

You can use the following command to reduce the allocated space for root user:

tune2fs -r 2500 /dev/sda1

9. Remove unneeded accounts:

If your turnover rate is high, you most likely have several user accounts that aren’t being used.

To see if your account has been suspended, go to:

ls /var/cpanel/suspended or WHM > List Suspended Accounts

To close accounts, follow these steps:
WHM > Account Termination

You can use the following command to terminate an account:

 /scripts/killacct  <y/n>

10. Check for contrabands:

You can use a few locate commands to discover common files connected with copyright breaches, such as.mp3,.avi, and.exe, and have your customers remove them from the server if they are infringing on your service’s terms and conditions.

11. Consider a larger server:

Last but not least, we recommend that you upgrade to a larger server. If you have clients who require a lot of disc space and you can’t manage to optimise your disc space, you might consider upgrading to a larger server to meet their needs.