The introduction

A friend asked what happens when space continues to be occupied after deleting files on Linux. This situation has never happened to me before. At first, I thought that some process occupied the file, and the reason why the specific space was not released was not clear. So I looked it up, and there were people in this situation, and let’s take a look at their analysis.

Cause analysis and solution of the problem that space is still occupied after files are deleted in Linux

In Linux, when we delete a large file using rm, if a process opens the file without closing the handle to the file, the Linux kernel still does not free the disk space of the file. As a result, 100% of the disk space is occupied and the whole system cannot run properly. In this case, the df and du commands do not match the disk space. Df may show 100% of the disk space, but the du search directory occupies very little disk space. In this case, it can be concluded that some large files are occupied by some programs, and these large files have been deleted, but the corresponding file handle is not closed by some programs, so the kernel cannot reclaim the space occupied by these files. Use the following command to find which files is occupied by a certain programs: lsof -n | grep does print out all read and write operations against deleted files, this kind of operation is invalid, it is the root cause of the disk space disappearances. Kill -9 PID # Stop the process that opens the file to free spaceCopy the code

Ref

Troubleshoot the problem that deleted files continue to occupy space in Linux

Iptables Firewall configuration instance

I/O Model 06 – Direct I/O







Jamin Zhang
Creative Commons Attribution – International License for Non-Commercial Use 4.0



Jamin Zhang
Jekyll
liyouhai’s JekyllPure Theme