Tutorial - Disk Usage 100% on CyberPanel – How To Free Up Disk Space | Vevioz Developers

Tutorial Disk Usage 100% on CyberPanel – How To Free Up Disk Space

DevOps

Linux Systems Engineer
Joined
Oct 18, 2019
Messages
192
Reaction score
17
Points
18
Location
Novosibirsk, Russia
Website
addons.vevioz.com
Offline
Is it LiteSpeed spamming error.log in lsws/logs or large tmp files?

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:
  1. Large old backup files residing on the server that you have not deleted.
  2. 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.

Code:
/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​

Code:
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

Code:
EDITOR=nano crontab -e

Add

Code:
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
Code:
/home/cyberpanel/error-logs.txt

LiteSpeed Server Error Logs
Code:
/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.

There are some easy way to free up disk space safely.

Remove OpenLiteSpeed Cache folder​

Code:
rm -rf /usr/local/lsws/cachedata
For LiteSpeed Enterprise Cache folder

Code:
rm -rf /home/domain.com/lscache
You can do this for every domain. (By replacing domain.com with your domain)

Delete Backups​

Code:
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

Code:
rm -rf /home/backup/*

Remove old CyberPanel versions
Code:
rm -rf /usr/local/*.tar.gz
 
Top Bottom