VPS disk full full led to ngnix can not start


Suddenly found that the website can not open, the database shows that the link can not be linked, the database phpmyadmin management panel can not open, the website background view server hard disk is full, think about how I have not tossed recently, How suddenly the server hard disk is, look at the login control panel. As a result, the Disk usage is full, and the red is quite touching.

I really can't think of taking up such a large space, just reboot and see, then there is no more, because the disk usage is still moving after restarting, and ngnix is ​​not started. Try to start manually, the result is an error indicating that there is not enough disk space to start the ngnix server. The saddest thing is that ssh is also unable to connect because of insufficient disk space.

Fortunately, the simple shell that comes with the vps control panel can also be used. Enter df -h to check the disk usage. The result is 100% occupied, then all the way df -sh * locate the past and find the mysql directory full. (df ​​-h to see which directory is full, then cut into the directory and continue to track with df -sh *), the original is installed LNMP when the mysql log is enabled by default, and then full of all is mysql-bin.* Log file.

Resolve reason:

LNMP one-click installation package default installation of LNMP one-click package environment is not closed MYSQL log, if the data operation is more frequent will generate a large number of logs, Multiple files like mysql-bin.0000* are automatically generated under /usr/local/mysql/var/, and they are usually in the tens of megabytes to several GB, which will occupy the entire hard disk space, causing mysql to link. Or the website reports an error.


1, directly delete the existing log file root@ludis:/usr/local/mysql/var# rm -f ./mysql-bin.*

Execute the reset master, delete the mysql log is a temporary solution. In addition to rooting, we should disable mysql log generation.

2, close Mysql log-bin log function:
BASICvim /etc/my.cnf


Add in front On # comment out, :wq save and exit.

The last service ngnix restart can be.

Copyright © Windows knowledge All Rights Reserved