small du(1) question

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Thu Oct 20 00:01:47 UTC 2011


Chuck Swiger <cswiger at mac.com> writes:

> On Oct 19, 2011, at 1:37 PM, Alexander Best wrote:
>>> 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?
>
> Which blocksize?
>
> The filesystem's DEV_BSIZE kept in the superblock info, the logical sector size provided by the device to the BIOS/UEFI/firmware, or the actual physical device blocksize?

du(1) uses DEV_BSIZE, but it looks like that's the version from
sys/param.h, which is always 512.  I would suggest fixing that to
look at the filesystem's definition, but then I'd have to figure
out what the correct behaviour would be when recursing into
through multiple filesystems with different blocksizes.


More information about the freebsd-questions mailing list