Using CyberPanel for managing your server, you might come across with full disk space problem. You notice that there is suddenly a huge increase in disk usage on your CyberPanel dashboard. Some times you will get the following error
503 Service Unavailable – The server is temporarily busy, try again later!
Lets identify what may have caused this huge increase in disk usage and how can you prevent this from happening again?
Why you see disk usage 100% on CyberPanel?
When hosting your website on self-managed server or VPS. There are 99% chances that you must have configured some sorts of backups and logging (logs for debug any issue). There are some files that could be using huge disk space:
- Large old backup files residing on the server that you have not deleted.
- Large log files from web server or any other applications that you have not deleted after they are rotated by the application.
All these files could occupy large amount of space ending up causing Disk Usage 100% in CyberPanel.
First find out large directories and files
First try to find out large files and directories in your server, you can then decide if those files are safe to be deleted, ending up giving you more space.
If you are using CyberPanel, look for the following directories as they must be containing large files that you won’t need.
/home/domain.com/backup
/home/backup
/usr/local/lsws/logs
Free up disk space on server running CyberPanel
The very well known culprit are the OpenLiteSpeed logs, eating up most of your disk space. Caused by some error, LiteSpeed web server can create large number of error log files often very big in size. You can remove them via SSH.
Delete Large log files in lsws/logs
rm -rf /usr/local/lsws/logs/*
But if the logs are growing continually, Spamming error.log in lsws/logs, removing them manually is not very practical. You Have to find out what is causing error by checking the error.log files and try to fix the error.
You can delete log files in a cron job. Login as root via SSH. Open crontab
EDITOR=nano crontab -e
Add
0 0 * * * find /usr/local/lsws/logs/ -name ‘*log.*’ -delete
This will run the find
command once a day and delete
the files. Enjoy no more worries about disk space.
Find and fix the error in log file
There are many applications in CyberPanel that may cause errors. These error massages are recorded in their respective log files. Major ones are
CyberPanel Main Log File /home/cyberpanel/error-logs.txt
LiteSpeed Server Error Logs /usr/local/lsws/logs/error.log
Error: modSecurity [MODSEC]
Go here :8090/firewall/modSecurity
lower the value of SecDebugLogLevel
if not already zero.
Error: Failed to open the real time report: /tmp/lshttpd/.rtreport!
Check the owner and permission of /tmp/lshttpd, it should be owned by the user that lshttpd run as. You can also try this guide.
There are some easy way to free up disk space safely.
Remove OpenLiteSpeed Cache folder
rm -rf /usr/local/lsws/cachedata
For LiteSpeed Enterprise Cache folder
rm -rf /home/domain.com/lscache
You can do this for every domain. (By replacing domain.com with your domain)
Delete Backups
rm -rf /home/domain.com/backup/*.tar.gz
You can do this for every domain. (By replacing domain.com with your domain)
You can also do
rm -rf /home/backup/*
Remove old CyberPanel versions
rm -rf /usr/local/*.tar.gz