Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I execute the command df -h /tmp it says disk utilization is 100%, but when it try du -sh /tmp it says disk utilization is 2%.

I want to know why these commands shows different output, how these two commands work and what is the solution to this problem.

Context: /tmp is installed on it own file system. I am using Ubuntu 12.04 server edition on my VPS account. Due to this problem utilization of /tmp 100% according to df some programs complain about free space in /tmp.

share|improve this question
up vote 6 down vote accepted

du reports free space by scanning reachable inodes and calculating their size.

If a file is created, opened, and later deleted while it is still open, the program that opened it will continue to have access to the file, and writes and reads can be performed to that memory location on disk. du does not account for such open files whereas df does.

A simple restart should flush /tmp and solve your problem.

An alternative would be to scan open files and restart or kill the process that did not release the deleted files.

share|improve this answer

Make sure you sudo when running du. For instance, if you run du -hs /*, you won't see the real disk usage unless you add sudo.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.