Main Causes of Low Disk Space on a VPS and How to Fix Them

Most internal server services stop working properly when the disk runs out of space. You can often fix this yourself once you have found the cause. There may be several:
- Logs are not rotated
In this case new log files are created while the old ones pile up and are never deleted. To fix this, connect to the server via SSH and clear the files in the /var/log/ directory. SSH is a network protocol that lets you manage the operating system remotely. Once connected, a log can be cleared with a single echo command. This is how you clear the access log:
echo > /var/log/nginx/access.log
Note that log files should be cleared, not deleted, because deleting them can cause the system to malfunction.
Another way to solve the log problem on a VPS is to set up log rotation. For example, the ISPmanager hosting control panel makes it easy to deal with a VPS running out of space because of oversized logs. In ISPmanager 4, log archiving is configured in a separate Log rotation section.

You can set the retention period and the number of archives yourself and apply the settings to your domains.
In ISPmanager 5, go to WWW domains and double-click the site address to configure its logs.

In the settings window, find "Logs" and set the parameters there to free up space on the VPS.
- User session files pile up
If this is the cause, fix it in a few steps.
1) Log in to ISPmanager as root.
2) Open the Scheduler section. Depending on the panel version, it is located:
in ISPmanager 4 – under "Tools";
in ISPmanager 5 – under "System".
Then add the following commands to run once every 24 hours.
find /var/www/*/data/mod-tmp/ -name "sess_*" -exec rm {} \;
find /var/www/*/data/bin-tmp/ -name "sess_*" -exec rm {} \;
- In ISPmanager 4:
- In ISPmanager 5:

This job frees up disk space in the "mod-tmp" and "bin-tmp" directories by deleting the user session files in them.
Finding the largest files
To free up space, find the files that take up the most room on the server. Connect via SSH and run:
du -sch /path/* //path - the folder you want to check
Going down the directories this way, you will find the largest folder, and then all that is left is to clean it up. Now you know what to do when the disk runs out of space.
To avoid such problems, go to ukr.host and order VPS administration from professionals in this field.