Delete large files in centos

Source: Internet
Author: User
We found that the disk space of the tested server is 100%. Using df-lh and du & ndash; sh, the jenkins log file is located at 363 GB. I found several ways to delete large files on the Internet: 1. low: after rmrm deletes a large file, df & ndash; lh will check whether the disk is still occupied. this is because rm deletes files, and files are generally not immediately written to the disk, that is, the space is not immediately released. Solution

We found that the disk space of the tested server is 100%. Through df-lh and du-sh, the jenkins log file is located at 363 GB. I found several ways to delete large files online:

I. low: rm

After rm deletes a large file, df-lh checks whether the disk is occupied.

This is because rm deletes files, and files are generally not immediately written to the disk, that is, the space is not immediately released.

Solution:

1. restart the server (not recommended );

2. losf | grep deleted; view the deleted process

The process is not closed, so the disk space will not be released. you need to kill-9 PID. after killing the process, the space will be released.


II. input redirection:

The following methods are used to clear the file content, but do not delete the file.

1. echo>/path/to/somefile

2. cat/dev/null>/path/to/somefile

3.>/path/to/somefile

4:>/path/to/somefile

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.