Linux disk space is exhausted by unknown resources
In Linux, when we used RM to delete large files on Linux, but if a process opened the large file, but did not close the handle of the file, then the Linux kernel will not release the disk space of the file, resulting in disk space consumption of 100%, the entire system does not function properly. In this case, the disk space found by the DF and Du commands cannot be matched, the DF displays disk 100%, and the Du lookup directory has a small disk capacity.
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, resulting in the kernel cannot reclaim the space occupied by these files.
So, how to find those files are occupied by some programs, the command is as follows
Lsof-n | grep deleted
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
DD 31708 Higkoo 1w REG 8,2 5523705856 429590/data/filetest (Deleted)
command to play Lsof-n | grep deleted prints out all read and write operations for deleted files, which are not valid and are the root cause of the inexplicable disappearance of disk space
Note: I encountered the scene is a colleague deleted the MySQL table, but the execution of the RM table on the shell file, rather than through the drop table and other commands to delete tables, so MySQL will always occupy the handle of these table files, resulting in disk space 100%, in this case, No need to restart MySQL, just go to the MySQL client and execute flush tables.
Reference HTTP://HI.BAIDU.COM/HIGKOO/ITEM/6A478917D1A819DEBF9042F1
Good text to the top has been concerned about the collection of this article
Linux disk space is exhausted by unknown resources "Go"