Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Oct 2011 15:02:41 -0700
From:      Chuck Swiger <cswiger@mac.com>
To:        Alexander Best <arundel@freebsd.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: small du(1) question
Message-ID:  <D5BC40B0-159F-4F97-AB3F-B7D1EDCB459C@mac.com>
In-Reply-To: <20111019203713.GA19350@freebsd.org>
References:  <20111019193413.GA9065@freebsd.org> <6620A8F5-523D-4A1E-9CC1-9C2D917BF0C2@mac.com> <20111019203713.GA19350@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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?

> isn't there a way to automatically query the blocksize of the underlying device,
> instead of always asuming the blocksize is 512 byte?

There is a way to query the blocksize of a physical device-- ie, ATA's IDENTIFY DEVICE, or SCSI's MODE SENSE-- but various drives lie about their actual physical blocksize to work around bugs in BIOS and drivers.

Also, while one does prefer to have all of the three blocksizes mentioned above correspond for performance reasons, they aren't always the same.

Regards,
-- 
-Chuck




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D5BC40B0-159F-4F97-AB3F-B7D1EDCB459C>