8
df -k
/dev/sda6             25396228  21249088   2836240  89% /export
21G used

versus

du -sh /export 
3.4G    /export

The 3.4G is correct because we have removed all non essential file but free space reported by df is not consistent with the actual free space that should be there.

Why is this so?

Bernard Mwagiru
  • 183
  • 1
  • 5

3 Answers3

9

The files you removed are probably still opened by a process. Check:

lsof -a +L1 /export

I think this is because:

  • df checks blocks available (superblocks)
  • du totals up the space of each file.
Gaff
  • 18,569
  • 15
  • 57
  • 68
Lollekk
  • 106
  • 2
3

One or more applications have files open on /export, but the filenames themselves no longer exist (i.e. have been deleted).

Ignacio Vazquez-Abrams
  • 111,361
  • 10
  • 201
  • 247
2

They measure two similar but slightly different things. df measures capacity of a file system, and du measures a directory tree. For example, if you had the following:

 /dev/sda6 mounted on /exports
 /dev/sda7 mounted on /exports/extra

df of /exports only measures /dev/sda6, while a du of /exports would measure /dev/sda6 and /dev/sda7. There are some flags regarding crossing file system boundaries which would change the counts. The handling of symbolic links could also impact results.

Xenoactive
  • 1,040
  • 5
  • 7