SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


dfdu
Differences

This shows you the differences between two versions of the page.

Link to this comparison view

dfdu [2013/05/11 16:57] (current)
sjoerd created
Line 1: Line 1:
 += Df And Du Show Different Sizes =
  
 += Problem Description =
 +It happened to me today. Df shows 90% full, du shows just about 10% in use. So how does this happen?
 +If the files are deleted (by rm command for example) while they are being opened or used by a Linux program / process, the evil of “open file descriptor” problem arises and confuse the Linux file system on reporting the real figure of used disk space or free disk space available.
 +
 +In order to resolve the fake “disk space full” problem, i.e. to reclaim “used disk space”, you need to kill or terminate the “defunct process” - in this case, the rm command that turns to be defunct process while the files are being used.
 +
 +Once these defunct processes are terminated, the “open file descriptor” problem will be resolved, and both the du and df commands will agree to report the real file system used disk space or free disk space!
 +
 += Resolution =
 +How to find out and terminate or kill the defunct processes that cause open file descriptor problem, in order to resolve the difference of used disk space in du and df command?
 +
 +For this particular scenario, the lsof command (list open file command) is great to show light:
 +
 +<​code>​
 +lsof | grep "​deleted" ​
 +
 +or
 +
 +lsof | grep "​theprocessyouknowthenameof"​
 +</​code>​
 +
 +If it's a daemon, restart it (if possible), or kill the process. Problem solved!
 +
 +{{tag>​linux}}
dfdu.txt · Last modified: 2013/05/11 16:57 by sjoerd