More on du(1)

David Barts davidb at Pacer.UUCP
Fri Oct 5 03:29:11 AEST 1990


(If you haven't responded to my first post about du, please READ THIS
FIRST.  Thanks.)

Several people have already responded to my question on du(1) reporting
erroneous information (off by a factor of 2) when run on a remote
disk.  Most responses have been of the variety "du on the HP reports
usage in 512 byte blocks, while du in the Solbourne reports in kbytes."
This can NOT be the case, since I was running /usr/5bin/du (the System
V du, *not* BSD du) on the Solbourne.  Both du's correctly report size in
512 kb blocks on local filesystems and goof up on remote ones.

Two people wrote about the system block sizes being different and this
being the cause of my problem.  At first I doubted this, because both
systems run the Berkeley fast file system and have a block size of 8k,
right?  Apparently, st_blocks reports the size in a number of blocks,
where one block is contains DEV_BSIZE bytes (defined in <sys/param.h>).
DEV_BSIZE (512 bytes on the Solbourne, 1024 on the HP) is different on
both systems.

This blocksize ends up embedded in du, and each system's du thinks that
the entire world uses the same size it does.  In summary, avoid using
du on network directories--it does not give reliable information.
-- 
David Barts			Pacer Corporation, Bothell, WA
davidb at pacer.uucp		...!uunet!pilchuck!pacer!davidb



More information about the Comp.unix.internals mailing list