Solve the Problem of disk occupation in Linux (/dev/sda3 is full)

Source: Internet
Author: User
Tags apache log file apache log

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 ).

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.