small du(1) question

Alexander Best arundel at freebsd.org
Wed Oct 19 20:37:14 UTC 2011


On Wed Oct 19 11, Chuck Swiger wrote:
> On Oct 19, 2011, at 12:34 PM, Alexander Best wrote:
> > the du(1) man page states the following:
> > 
> > "
> >     -B blocksize
> >             Calculate block counts in blocksize byte blocks.  This is differ-
> >             ent from the -k, -m options or setting BLOCKSIZE and gives an
> >             estimate of how much space the examined file hierarchy would
> >             require on a filesystem with the given blocksize.  Unless in -A
> >             mode, blocksize is rounded up to the next multiple of 512.
> > "
> > 
> > is this a doc bug, or does du(1) really always assume that every filesystem's
> > blocksize == 512?
> 
> The default blocksize is 512 bytes.
> 
> The -B option flag lets you tell du to assume a different filesystem blocksize.

so when running freebsd on a hdd with a blocksize of 4k, a simple 'du -h' will
always display incorrect results, unless '-B 4096' was also specified? isn't
there a way to automatically query the blocksize of the underlying device,
instead of always asuming the blocksize is 512 byte?

cheers.
alex

> 
> Regards,
> -- 
> -Chuck
> 


More information about the freebsd-questions mailing list