I took over the project, the site suddenly collapsed, the final location is because the disk is full of reasons. After the project has been running for a long time, the log file becomes more and more huge, which slows down the running speed of the system. If the disk is full, the file cannot be written, which will cause the website to crash.
In this case, the following two commands are enough.
View disk usage
disk file help
[[email protected]_6_184_centos Uploads]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 50G 36G 12G 77% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 24K 1.9G 1% /dev/shm tmpfs 1.9G 464K 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup tmpfs 380M 0 380M 0% /run/user/0 tmpfs 380M 0 380M 0% /run/user/1001
This is a problem
50GThe size of the disk (including the system disk), the system kernel should be only
/dev/vda1It’s a mount disk.
Find large files
du -h --max-depth=1 /www/wwwroot
--max-depthIt means the depth of the search,
1It’s a folder
0It’s a file. As long as you know this command, you can locate large files.
/www/wwwrootIs to find the file under the path.
*The default is to find the files in the current directory.
Use the above command to navigate to
logsIt’s a big folder. This is where the logs are kept.
You can see the three years of operation
nginxThe log is very big, that’s it
echo "" >access.log
This makes room for the system
This work adoptsCC agreementReprint must indicate the author and the link of this article