Learn what is causing your low disk space and how you can manage it.
In time, you might notice that the disk space is getting critically low on your machine and you start receiving alerts.
We recommend that you do not ignore them and act promptly to ensure that your server is 100% operational.
Here are some tips from the Bunnyshell Team:
-
Install ncdu (sudo apt install ncdu) and try to see what is using up most of the space using the command: sudo ncdu /
-
If you are using your own backup solution, you will need to ensure that you clean them up as they can take up a lot of space over time. These backups are usually present in the application folders: /var/www/<name_of_application>/app/
-
If you are using WPReset (WordPress plugin) our recommendation is to remove it. That plugin is known to cause excessive writes to the MySQL database which can easily fill up your disk space. You can tell if this is the case if you have an excessive number of binlog files in /var/lib/mysql/. Do NOT delete them by hand. Please refer to the MySQL documentation for the clean-up procedure.
-
If you are using rank math pro (WordPress plugin) please remove it. Customers reported that this plugin filled their databases and thus lead to space exhaustion.
- If your database is doing many updates or inserts per hour please set the expire-logs-days = 1 in /etc/mysql/my.cnf and restart the mysql service.
-
Check the logs. It can be that your logs are not being rotated correctly, therefore it is good to check if they are taking too much space. In order to check this, you will have to take a look in /var/log. If you need to clean the logs follow the steps listed in this article.
-
If you are using OpenLiteSpeed check that the logLevel is set to INFO or 0 depending on the configuration in /usr/local/lsws/conf
-
find /usr/local/lsws/conf/ -name '*.conf' -exec sed -i 's/logLevel DEBUG/logLevel INFO/g' {} \;
find /usr/local/lsws/conf/ -name '*.conf' -exec sed -i 's/logLevel 9/logLevel 0/g' {} \;
systemctl restart lsws
rm /var/log/lsws/*202[1-2]* -
You can empty some files such as bunnyshell.log or discovery.log using the command: echo '' > /var/log/bunnyshell.log
- You can set a fixed size for journalctl if you notice that it is taking more than 3G in /var/log
- journalctl --disk-usage
journalctl --vacuum-time=2d
sed -i '/#SystemMaxUse=/ c\SystemMaxUse=300M' /etc/systemd/journald.conf
systemctl restart systemd-journald
- journalctl --disk-usage
-
Generally, you can expect your server to consume at least 6GB of space on the OS and the needed tools and up to 4GB of space for swap usage (in some scenarios). This means that, just for your server to function, 10GB are used by the server itself.
Furthermore, if enabled, the backups for the database or applications, you can expect even more space to be used by those operations.
If you wish to learn more about backup and restore, please be sure to give this article a read.
If you find that the remaining space is insufficient after cleaning your server, we recommend you either increase the disk size or change your instance type to something more suitable for your needs.
This article might help you if you wish to learn how to add more storage to your VM.