Archive for the tag 'df'

SBDavid

Difference in du and df results

Difference in du and df results

We normally see issues where the “du” and “df” outputs different disk space usage.

A common scenario is filling up of /var partition due to log files.

We usually clear the logs and the “du” outputs the expected result whereas “df” still shows the earlier reading.

This is due to the fact that, some user processes keeps the deleted files open. “du” doesn’t show that since the file (if it is removed), or the file contents (if it is cleared) is not there in the current working directory.

“df” will continue to display the previous disk space, until the space is de-allocated. To de-allocate this space either the file descriptor of the file should close or the process should exit.

Therefore you can try restarting the daemons used by these files or reboot the server.