App server root full, always alarm
DF shows that the root partition has used 90% of the space, but the sum of the Du root partition is only about 40G, the partition should not have a large number of small files, so there should be no large number of small files caused by block write full problem.
Online search issued by the existing may be a program to operate large files resulting in the file handle is not released, these programs are occupied by the file handle will be DF is considered to exist on the hard disk.
This is explained on the Internet:
Du is to put all the files in the directory under the statistics, and DF is taken from the file system, the statistics are allocated space, and includes the space that is occupied by the program application.
If it appears, there should be a lot of space in the/directory occupied by a program.
Processing Method Lsof/|grep Delete
COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
Mongod 2842 root 15u REG 251,0 536870912 6296116/var/lib/mongodb/vida_log.3 (Deleted)
Mongod 2842 Root 16u REG 251,0 536870912 6306826/var/lib/mongodb/vida_log.4 (Deleted)
Mongod 2842 Root 10u REG 251,0 536870912 6345649/var/lib/mongodb/vida_log.0 (Deleted)
Mongod 2842 root 11u REG 251,0 536870912 6345658/var/lib/mongodb/vida_log.1 (Deleted)
Mongod 2842 Root 12u REG 251,0 536870912 6345659/var/lib/mongodb/vida_log.2 (Deleted)
Ruby 25149 vidafm 3w REG 251,0 5594054 7351133/var/www/vida_api_120614/log/development.log.4 (deleted)
Ruby 26599 vidafm 3w REG 251,0 5594054 7351133/var/www/vida_api_120614/log/development.log.4 (deleted)
Nginx 9388 Nobody 82u REG 251,0 90112 6162236/opt/nginx/client_body_temp/0004778814 (delet Ed
You can see that the size of this line of files is particularly large, and is already a delete state, the file has been deleted but the file handle is not released by the program.
Kill these processes to free up space
After re-df-h found that the available space has become 90g+, very comfortable.
Another explanation of DF and du on the internet
The Du-sh command increments the total number of blocks used by the file system by adding all the directories, symbolic links, and the number of blocks used by the file system to the specified filesystem.
The DF command, by viewing the file system disk block allocation graph, draws the total number of blocks and the remaining blocks.
File system Allocation Some of these disk blocks are used to record some of its own data, such as I node, disk distribution map, indirect block, super block and so on. This data is not visible to most user-level programs, often referred to as meta data.
The du command is a user-level program that does not take meta data into account, while the DF command looks at the file system's disk allocation diagram and considers meta data.
As a result, DF calculates a used space that is slightly larger than the results of the DU calculation.
lsof handling the problem of inconsistent df and du sizes