Record the deletion of large files at a time, but the disk does not release space

Source: Internet
Author: User
Tags rsyslog
The/var mounted by/dev/XXX on the server is almost over 90%, so you need to clear the log file.
DF-H
...
/Dev/xxx xxG 1.0g 93%/var
...

Check the file in/var/log
CD/var/log
Ls
...
-RW -------. 1 Root 26G October 20 15:18 XXXX. Log
...

That is, xxxx. the log file occupies a lot of disk space. After reading the content, we found that it was a SYSLOG log file. It was saved for several months, so we deleted it.
Rm XXXX. Log
Then DF-H
...
/Dev/xxx xxG 1.0g 93%/var
...
The disk space is not released. Some programs are still operating on this file, and the pointer is not released.
Lsof | grep deleted | grep XXXX. Log
Rsyslogd XXX1 root XW Reg 8, 2 xxxxxxx xxxx/var/log/xxxx. Log (Deleted)
The SYSLOG program is still operating on this file.
So I used the process number of this program: XXX1 kill it.
Kill-9 XXX1
After completion, we found that rsyslog was not started.
Restart only
/Etc/init. d/rsyslog restart
Disable the system logger: [failed]
Start the system logger: [OK]

Check the disk space and find that the space has been released.
After that, Google clears the file before deleting the file, which can quickly release the disk space.
Echo ""> XXX. Log
Rm-rf xxx. Log
This method will be retried next time

Record the deletion of large files at a time, but the disk does not release space

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.