Where is my disk space? The "du" and "df" commands disagree.

Where is my disk space? The "du" and "df" commands disagree.

If a process is holding open a file, and that file is removed, the space
belonging to the file is not freed until the process either exits or
closes the file. This space is counted by "df" but not by "du". This
often happens in /var/log or /var/adm when a long-running process (e.g.
syslog) is holding open a file. In the case of syslog, send it a HUP
(e.g. kill -HUP ).

You can use LSOF (ftp://ftp.cerias.purdue.edu/pub/tools/unix/sysutils/lsof)
to find which processes are holding open a particular file.

Thanks to Stefan Voss and
Michael R. Zika

Under Solaris 2.6 and later, files which have been unlinked can
still be accessed through the /proc interface. If a process is
holding open such a file for writing, but it's inconvenient or
impractical to kill the process or get it to close the file, you can
free up the disk space by truncating (not removing) the file from
under /proc; e.g.,

# cd /proc/1234/fd
# ls -l


Home
FAQ