Main Factors of Lack of Space on VPS and Ways to Fix Them

Все, что нужно знать о виртуальном сервере

Article title: Main Factors of Lack of Space on VPS and Ways to Fix Them

Article body:

Most internal server services stop functioning normally when space runs out. Often this problem can be handled yourself, after determining the cause that led to this problem. There can be several:

  • Log rotation is not performed

In this case, new files are created, while old ones accumulate and are not deleted. To eliminate this type of problem, you need to connect to the server via SSH and clear files in the /var/log/ directory. SSH is a network protocol that allows you to manage the operating system remotely. After connecting to the server via SSH, the log is cleared with just one “echo” command, here’s how to clear the access log file:

 echo > /var/log/nginx/access.log

It should be noted that virtual server files need to be cleared, not deleted. Since deletion can lead to system failure.
Another point should be added to eliminate the VPS server logging problem – this is setting up log rotation. For example, the ISPmanager hosting control panel allows you to easily eliminate such a problem as lack of memory on a virtual server due to excess logs. In ISPmanager version 4, the log archiving setting is located in a separate Log Rotation section.
Ispmanager 4 logs
You can independently determine the retention period and number of archives, applying settings to domains.
In ISPmanager 5 to configure logs, you need to go to WWW-domain, then double-click on the site address.
Ispmanager 5 logging
In the pop-up settings window, find “Logs” where you need to set parameters to free up space on the VPS server.

  • Accumulation of user session files

Lack of disk memory on a VPS server that appeared for this reason is eliminated in several steps.
1) First, log in to the ISPmanager control panel as root user.
2) Next, depending on the control panel version, perform the following action: go to the Scheduler section.
For ISPmanager 4 it is located in “Tools”;
for ISPmanager 5 –> “System” section.
It remains to add a command with execution 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:
    IspManager 4 deleting sessions
  • >In ISPmanager 5:
    IspManager 5 deleting sessions

Such a task will eliminate the lack of disk space in the “mod-tmp” and “bin-tmp” directories by deleting user session files inside these directories.

Identifying the Largest Files

Lack of memory is eliminated by identifying files that take up the most space on the server. To do this, connect to SSH and enter the command:

 du -sch /path/* //path - name of the folder about which you want to get information

By gradually recursively scanning directories this way, we will identify the “heaviest” folder, then all that remains is to clear its contents. Thus, when you don’t have enough disk memory, you already know how to act.
To prevent such a problem, go to the ukr.host website and order VPS server administration from a company that is a professional in this field.