Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: du and df showing different disk space usage  (Read 3783 times)

0 Members and 1 Guest are viewing this topic.

rafeeqi

  • Guest
du and df showing different disk space usage
« on: May 21, 2017, 10:43:04 am »
                  Sometimes you will come across situation where the server disk space shows full on df but du shows plenty of space left. This is because you can remove a file that is still in use by some application and for this application it remains available because file descriptor in /proc/ filesystem is held open. So if there are such open descriptors to files already removed, space occupied by them is considered as used by df but they can not be taken into account by du because there are no filenames associated with them.

The following command will list those processes:

# lsof | grep '(deleted)'

You can either kill those process or restart the service that seems to be causing this.

In case you need to kill all the process at once use the following command:

# for n in $(lsof | grep '(deleted)' | awk '{print $2}') ; do kill -9 $n; done