"df" and "du" give different results!

"df" and "du" give different results!

Post by Brendan D J Murph » Wed, 23 Jul 1997 04:00:00



Lately, I have been monitoring our disk-space.

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!

Why the inconsistancy?

Thanks
Brendan

 
 
 

"df" and "du" give different results!

Post by John D » Thu, 24 Jul 1997 04:00:00


On behalf of the Pixies, Brendan D J Murphy mused:

Quote:>Lately, I have been monitoring our disk-space.

>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!

using the -k switch gives the amount in Kilobytes. Bear in mind that
most systems reserve a percentage of the disk for root use only.

John

--
John M Dow : "Heh, yoo, whears muh chips?" : Wullie van Beethoven
        UNIX Systems Administrator, *surf Ltd, Scotland

http://www.veryComputer.com/ :       http://www.veryComputer.com/

 
 
 

"df" and "du" give different results!

Post by Mario Klebsch DG1 » Thu, 24 Jul 1997 04:00:00



>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.

73, Mario
--

Institut fuer Robotik und Prozessinformatik der TU Braunschweig
Hamburger Strasse 267, 38114 Braunschweig, Germany

 
 
 

"df" and "du" give different results!

Post by Kurt M. Hockenbu » Thu, 24 Jul 1997 04:00:00



: Can somebody please explain why "du" and "df" give inconsistant results?

Some possible reasons:

Open files with no entry in the directory tree.
   For instance, you rm some syslog file, but don't HUP syslogd.
   syslogd keeps the file open, and continues writting to it.  This
   will show up in "df".  In fact, it can even fill your whole partition.

Metadata space.
   Space for the filesystem overhead might be counted toward "df" but not
   "du".  

If the difference is only a few %, I wouldn't sweat it.
If it's a large difference, look for programs that may have removed
files open.

 
 
 

1. Problems with "df" and "du" on "/var"

Hello,

I hope you have some help for a "UNIX-Newbie". Here is my problem:

When I start the command "df" on the directory "/var" (on a UNIX-Server with
SunOS 5.6) I get the information, that approximately 113 MB disk space are
occupied. When I use the command "du -k /var" the system says that are about
50 MB (58 MB as root) in use.
By doing the same process on other directories, I have no problems.

Can you help me? I hope so. Thanks.

Greetings
Michael

2. Internal Modem Setup

3. GETSERVBYNAME()????????????????????"""""""""""""

4. Testing LJCRF News Pipeline

5. Urgent: "lpc stat" and "lpc stat lj02" gives different result

6. LILO with boot over 1024 cylinders?

7. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""

8. Shifted display on Diamond Stealth 64 Video VRAM (3240)

9. "weof" operation in "mt" command gives "permission denied"

10. Type "(", ")" and "{", "}" in X...

11. "du -sx" and "dh" differs dramatically

12. odd behaviour of "pwd" & "df" after Live Upgrade?

13. Bug in ksh 88[df] "print -u2" and/or "read" statement.