[comp.unix.wizards] Size of NFS "block"

jqj@gvax.cs.cornell.edu (J Q Johnson) (07/15/87)

Keywords:


Note that varying block sizes is particularly a problem in an NFS environment.
When I do a "du", it reports sizes in blocks derived from a stat of the file
(the st_blocks field).  Unfortunately, there is no easy way for du to know
what the blocksize is (the st_blksize field is "suggested" transfer size
by definition).  As a result, du gives the wrong information when applied to
a remotely mounted NFS file system if that remote system uses a different
blocking factor from what the local system expects (e.g. at Cornell, Gould
vs. SUN).

Since it is clearly inappropriate for du to do a statfs for each directory
it looks at, and since checking st_dev for changes is a rather unreliable
way to find out when you've crossed filesystem boundaries, I would recommend
that the stat structure be extended on NFS systems with a field that tells
the user what blocksize the st_blocks parameter of a stat is measured in.

woerz@iaoobelix.UUCP (07/24/87)

> /***** iaoobelix:comp.unix.wiz / gvax!jqj /  9:27 pm  Jul 15, 1987*/
> Subject: Size of NFS "block" (was Size of SysV "block")
>
>
> Note that varying block sizes is particularly a problem in an NFS environment.
> When I do a "du", it reports sizes in blocks derived from a stat of the file
> ...

I looked at the manual of du on our suns and our VAX running vanilla
4.2BSD, they state clearly that du reports the size in kilobytes. I
think this has been necessary to change, since under 4.2BSD it is
possible to have different block sizes for different partitions on
one disk, i.e. we run /tmp as a seperate partition with a block size
of 8KB, while were running / with only 2KB blocks. This is mainly for
space and access speed considerations.
> /* ---------- */

jqj@gvax.cs.cornell.edu (J Q Johnson) (07/31/87)

In article <8300008@iaoobelix.UUCP> woerz@iaoobelix.UUCP writes:
>> /***** iaoobelix:comp.unix.wiz / gvax!jqj /  9:27 pm  Jul 15, 1987*/
>> Note that varying block sizes is particularly a problem in an NFS environment.
>> When I do a "du", it reports sizes in blocks derived from a stat of the file
>> ...
>I looked at the manual of du on our suns and our VAX running vanilla
>4.2BSD, they state clearly that du reports the size in kilobytes.

Yes, but in fact they are wrong.  Both du versions use the "blocks" value
returned by stat(), and assume they know the size of a block.

On bullwinkle, a Gould 9080 running Gould OS 2.0.2 (almost pure 4.3BSD):
    bullwinkle-2% ls -l /fs/moose/mu/jqj/foo
    total 744
    -rwxr-xr-x  1 jqj        746054 Jul 31 14:41 vmunix
    bullwinkle-3% du /fs/moose/mu/jqj/foo
    745     /fs/moose/mu/jqj/foo
On ninib, a SUN-3/50 running SunOS 3.3:
    ninib-18% du /fs/moose/mu/jqj/foo
    373     /fs/moose/mu/jqj/foo
    ninib-19% df /fs/moose/mu/jqj/foo
    Filesystem            kbytes    used   avail capacity  Mounted on
    bullwinkle:/fs/moose/mu
			  222735  197881    2580    99%    /fs/moose/mu