From owner-freebsd-questions@FreeBSD.ORG Wed Oct 19 22:02:58 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94240106566C; Wed, 19 Oct 2011 22:02:58 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from asmtpout024.mac.com (asmtpout024.mac.com [17.148.16.99]) by mx1.freebsd.org (Postfix) with ESMTP id 7B1898FC0A; Wed, 19 Oct 2011 22:02:58 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from cswiger1.apple.com ([17.209.4.71]) by asmtp024.mac.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPSA id <0LTC00AEZ2KHMI00@asmtp024.mac.com>; Wed, 19 Oct 2011 15:02:42 -0700 (PDT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.4.6813,1.0.211,0.0.0000 definitions=2011-10-19_09:2011-10-19, 2011-10-19, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1012030000 definitions=main-1110190284 From: Chuck Swiger In-reply-to: <20111019203713.GA19350@freebsd.org> Date: Wed, 19 Oct 2011 15:02:41 -0700 Message-id: References: <20111019193413.GA9065@freebsd.org> <6620A8F5-523D-4A1E-9CC1-9C2D917BF0C2@mac.com> <20111019203713.GA19350@freebsd.org> To: Alexander Best X-Mailer: Apple Mail (2.1084) Cc: freebsd-questions@freebsd.org Subject: Re: small du(1) question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2011 22:02:58 -0000 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