bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: du on SuSE7.0


From: Bob Proulx
Subject: Re: du on SuSE7.0
Date: Fri, 2 Mar 2001 23:15:06 -0700

Petra

Thanks for the report.  But I think it is doing the right thing.

> prometheus{/home/systems/syk/src}4 % l RCS
> total 11
> -r-xr-xr-x   1 syk      systems      5261 Feb  6  1997 disk_usage,v
> -r-xr-xr-x   1 syk      systems       784 Oct  7  1997 ecmwf.hippi,v
> -r-xr-xr-x   1 syk      systems       670 Feb  6  1997 ecquot,v
> -r-xr-xr-x   1 syk      systems      3978 Aug 24  1998 magplot,v
> -r-xr-----   1 syk      systems      1464 Sep 29  1995 proc_count,v
> -r-xr-xr-x   1 syk      systems      2100 Feb  6  1997 top10,v
> -r-xr--r--   1 syk      systems      3083 Sep 29  1995 top10.list,v
> -r-xr-xr-x   1 syk      systems      1700 Sep 29  1995 top10_send,v
> 
> prometheus{/home/systems/syk/src}12 % bc
> bc 1.05
> Copyright 1991, 1992, 1993, 1994, 1997, 1998 Free Software Foundation,
> Inc.
> This is free software with ABSOLUTELY NO WARRANTY.
> For details type `warranty'. 
> 5261 + 784 + 670 + 3978 + 1464 + 2100 + 3083 + 1700
> 19040

Very good.  But you forgot the directory size.  Please add in the size
of 'ls -ld RCS' too.

> prometheus{/home/systems/syk/src}14 % du -b RCS
> 12288   RCS

That would make the directory smaller than 19040-12288=6752.  It is
probably 4096 bytes in size.

Remember that du is reporting information in terms of filesystem
blocks which are 512 bytes each.  So everything is quantized into
those units.

Even if you have a very small file of only a few bytes the filesystem
can only allocate disk blocks in the 'frag' size.  That is tunable to
some extent but is generally frag size is 512 bytes and disk block
size is 8k bytes.  (Those numbers are so filesystem specific I hate to
bring them up since I am sure they will be tuned differently on
different filesystems.  Take them as a general guideline of
traditional unix filesystems only.)  The combination of blocks and
frags makes large files efficient because blocks are allocated in 8k
chunks.  Small files are pretty good by not wasting the entire 8k
block by using a 512 byte fragment of the block.

This type of filesystem was primarily pioneered by the Berkeley fast
filesytem.  Probably the best source of information is one of the
texts on UNIX internals such as The Design and Implementation of the
BSD 4.4 Operating System by McKusic, Bostic, Karels and Quarterman.  I
don't have the book in front of me and am working from memory so I
hope that actually does have the information I am remembering in it.

> Thanks for some feedback, I've got a number of unhappy users here :-)

Don't worry.  Be happy.  In addition to the GNU package documentation
please refer to the online UNIX95 docs.

  http://www.unix-systems.org/single_unix_specification_v2/xcu/du.html

    By default, the du utility writes to standard output the size of
    the file space allocated to, and the size of the file space
    allocated to each subdirectory of, the file hierarchy rooted in
    each of the specified files. The size of the file space allocated
    to a file of type directory is defined as the sum total of space
    allocated to all files in the file hierarchy rooted in the
    directory plus the space allocated to the directory itself.

And read "file space allocated to" as filesystem blocks and not file
size as reported by ls.  This is not quite the same as the spaced used
to spool this off to serial backup or some such.  But if you are
interested in disk used then disk blocks is the unit of measure.

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]