Linux Server disk full problem resolution (/DEV/SDA3 full)

Source: Internet
Author: User
Tags log log apache log

Today, a certain electrical and technical department leader found a problem, said their server hard drive full. The log files are deleted, but the hard disk space is still full. So df-h looked at the status of each mount point below (pictured below).

/dev/sda3 occupies 100%, then we du-s-H./* Look at the occupancy of the catalog (figure below).

Linux disk mount point directory occupancy (figure)

The sum of the directories under the mount point is much less than 4.5G, so what is taking up the hard drive?

Here's the answer to the question:

When the Apache/tomcat service is running, it clears the log of the running service, causing the problem of/dev/sda3 full. In general, most services, including scripts, are not able to delete the log files that are currently being written while they are running.

Principle Analysis:

1. The current Access.log log is being occupied by the Apache process.
2. Delete Access.log through the RM command, which actually deletes only the file name (the log file applies a count of not 0, so the space is not freed).
3. After removing access.log through the RM command, Apache still writes logs to Access.log, and when the Apache process is turned on, it has been positioned through Access.log to the inode of the file, which means that the log is not passed through access.log, so even if you delete access Log,apache still writes logs to the Inode node where the access.log resides, resulting in increased disk space.
4. Because the deletion of the access.log, so we can not find the file, Du also can not find, there will be a hard drive full but do not see what files are occupied.

(Write not very detailed, do not understand everyone again Google.) )

Workaround:

Restart the log file related services or programs, such as: Apache Log files Restart Apache (the following figure, restart only after the hard disk space occupy normal).

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.