Next, let's take a look at the article about how to solve the problem of disk occupation of Linux servers (/dev/sda3 is full). We hope that people who encounter such problems can help us.
Today, leader of an e-commerce technology department found a problem, saying that their server hard disk is full. Delete all log files, but the hard disk space is still full. Therefore, df-h checks the status of each mount point (for example ).
/Dev/sda3 occupies 100%, so we can view the directory usage (for example) in du-s-h ).
Linux disk mount point directory usage (figure)
The directory and far from the mount point are smaller than 4.5 GB. What occupies the hard disk?
The following are the answers to this question:
When the apache/tomcat service is running, logs of the running service are cleared, resulting in/dev/sda3 being full. Generally, most services (including scripts) cannot delete the log files currently being written at runtime.
Principle Analysis:
1. The current access. log is being occupied by the apache process. 2. Use the rm command to delete access. log. Actually, only the file name is deleted (the log file's application count is not 0, so the space will not be released ). 3. the access. after logging, apache still writes logs to access. log, when the apache process is enabled, the access. log located the inode of the file, that is, the log is not written through access. log, even if the access. log, apache still writes logs to access. the inode node where the log is located, resulting in increased hard disk space. 4. Because access. log is deleted, we cannot find the file, and du cannot find it. The hard disk is full, but we cannot see which files are occupied.
(If you do not know the details, you can google them again .)
Solution:
Restart the related services or programs of the log file. For example, restart apache if the log file is an apache Log File (for example, hard disk space usage is normal after restart ).