In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
How to solve the problem that the Web server disk is full? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Problem: the hard disk shows that it is full, but the sum of the hard disk space occupied by du-sh / * is far less than the size of the hard disk.
That is, you can't find out how the hard disk partition is full.
This afternoon, I received an emergency request from a student, saying that the hard disk of the production line server was full. All the logs that should be deleted have been deleted. But the space is still full and the situation is critical. This problem was encountered 3-4 times directly and indirectly many years ago. I used to be too lazy, this time I recorded it and shared it with you.
The related logs are as follows:
█ View hard disk Partition size
[root@www ~] # cat / etc/redhat-release
CentOS release 5.3 (Final)
[root@www] # df-h
Filesystem Size Used Avail Use% Mounted on
/ dev/sda3 117G 111G 0 100% /
/ dev/sda1 145m 126m 9% / boot
Tmpfs 3.0G 0 3.0G 0% / dev/shm
This is a web server (apache+tomcat+mysql)
Use the dh-h command to view the total size of 117G, using 111G
[root@www /] # fdisk-l
Disk / dev/sda: 146.8 GB, 146815733760 bytes
255 heads, 63 sectors/track, 17849 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/ dev/sda1 * 1 19 152586 83 Linux
/ dev/sda2 20 2108 16779892 + 82 Linux swap / Solaris
/ dev/sda3 2109 17849 126439582 + 83 Linux
[root@www /] # fdisk-l / dev/sda3
Disk / dev/sda3: 129.4 GB, 129474132480 bytes
255 heads, 63 sectors/track, 15741 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk / dev/sda3 doesn't contain a valid partition table
=
█ uses the du command to see which directories take up space
[root@www /] # du-sh / *
8.6M / bin
6.1M / boot
2.8g / data = "here is the DB directory
124K / dev
60M / etc
1.6G / home = "here is the log directory
120M / lib
24M / lib64
16K / lost+found
8.0K / media
0 / misc
12K / mnt
0 / net
8.0K / opt
0 / proc
614M / root
35M / sbin
8.0K / selinux
24K / server
8.0K / srv
0 / sys
24K / tmp
2.5G / usr
29g / var = "here is the www directory
Add: du-- max-depth=1-h (note that there are two before max) can count the space used by each subdirectory under the current directory
It can be seen that the sum of all the above directories is far less than the total space occupied by 111G, what occupies the hard disk, can not be found?
-
Answer:
The cause of the above problem:
When the apache/tomcat service is running, the log of the running service is cleared. Here, the log files of apache and tomcat that are being written on the same day or are being written are cleaned, resulting in the above problems. (for details of the principle, see below)
The following is extended:
In general, most services, including scripts, cannot delete log files that are currently being written at run time. Please bear this in mind.
The solution of this article is:
Find the machine's own services, and then restart apache and tomcat.
After restarting apache:
[root@www 07] # df-h
Filesystem Size Used Avail Use% Mounted on
/ dev/sda3 117G 109G 2.3G 98% /
/ dev/sda1 145m 126m 9% / boot
Tmpfs 3.0G 0 3.0G 0% / dev/shm
After restarting tomcat:
[root@www] # df-h
Filesystem Size Used Avail Use% Mounted on
/ dev/sda3 117G 38G 74G 34% /
/ dev/sda1 145m 126m 9% / boot
Tmpfs 3.0G 0 3.0G 0% / dev/shm
After reading the above, do you know how to solve the problem that the Web server disk is full? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.