In the last months, I've been using CloudPanel as a free alternative to Plesk since the prices of Plesk skyrocketed at the beginning of the year. CloudPanel is undoubtedly a handy, lightweight, and user-friendly control panel specially designed for hosting web applications on the cloud. Of course, it offers several advantages and limitations compared to Plesk or Cpanel.
One of the problems I discovered recently regarding disk usage, is that even though the remote backup feature is disabled:
CloudPanel creates daily a local backup of the databases of each website and stores it in the /home/website-user/backups/databases/
directory. You will find a backup of your database with a retention period of 7 days by default for every single website you host in the same server.
This feature itself is quite useful as you'll have 7 versions of your database in case something goes wrong, however, if you're short on disk space and if your database size is considerable, this is an issue because they're generated automatically and the backup size could be used for extra stuff such as new projects or uploads.
Important
We do not encourage you not to use backups, backups are important, always find a way to backup your information somewhere else. Since we have custom backup scripts that upload stuff to Buckets, we can delete the local backups to save some disk space. Follow this tutorial if you know what you're doing.
Disable automatic database backups
The first thing you need to do is to access your server via SSH:
ssh root@your-server-ip
Once you have access to the terminal, proceed with the modification of the cron file of CloudPanel which is located in the /etc/cron.d/clp
directory:
nano /etc/cron.d/clp
In this file, you need to locate the line that is responsible for running the automatic database backups, which is the clpctl db:backup
command. In the file you will find a line similar to the following one:
15 3 * * * clp /usr/bin/bash -c "/usr/bin/clpctl db:backup --ignoreDatabases='db1,db2' --retentionPeriod=7" &> /dev/null
All you need to do is to either delete or comment the line out by adding a # at the beginning of the line:
#15 3 * * * clp /usr/bin/bash -c "/usr/bin/clpctl db:backup --ignoreDatabases='db1,db2' --retentionPeriod=7" &> /dev/null
Quit the editor saving your changes and that's it! Your server will not generate the backups of your databases anymore. Be sure to remove manually any remaining backup that may have been previously generated to save some space.
Final thoughts
Remember what I mentioned at the beginning of the article, only disable the generation of your backups if you know what you're doing and you're generating them in other ways.
- I generate the backups and upload them immediately to a S3 bucket, in this way, my server disk has some extra space to fit in more projects.
- Backups consume significant disk space, so if the server runs out of space, it can directly impact the database performance causing slow queries or even downtime.
- Many standards such as GDPR and ISO27001 require storing backups remotely to accomplish the standards instead of being stored locally.
Happy coding ❤️!