>On behalf of the Pixies, Brendan D J Murphy mused:
>>Can somebody please explain why "du" and "df" give inconsistant results?
>>When I run "du" on one of our file systems, I get a particular answer.
>>When I run "bdf" the amount of disk space used is different.
>>I am aware that "bdf" (or "df") gives answers in Kbytes, but when I
>>multiply this answer by 2, it is still different to the number of
>>512-byte blocks reported as being used by the "du" command.
>>In fact, sometimes, it is wildly out!
There are several reasons for different results. First, you can have
links. When you have e.g. a 8 MByte file and two links (the real
links, not symbolic ones), the file will count doulbe when using du.
The second problem often are files with holes. Core-dumps often have
holes and you can see them growing, when you copy them. If you open a
file for reading, lseek to 5M offset and write 5 ytes to that file, it
will only use a few block on disk for data and indirect block
pointers. But its size is 5MByte.
The third problem is files without any links on disk. If you create a
file, have an open handle to this file and unlink it, the file still
exists as long as the handle stays open. But it is not found in any
directory. So du cannot count it, but the blocks still are used block
in df's output.
Institut fuer Robotik und Prozessinformatik der TU Braunschweig
Hamburger Strasse 267, 38114 Braunschweig, Germany