From owner-freebsd-fs@FreeBSD.ORG Wed Oct 17 11:49:31 2007 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90F5116A421 for ; Wed, 17 Oct 2007 11:49:31 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 4C7FA13C4B2 for ; Wed, 17 Oct 2007 11:49:31 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 8D2C32093; Wed, 17 Oct 2007 13:49:21 +0200 (CEST) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: -0.0/3.0 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on tim.des.no Received: from ds4.des.no (des.no [80.203.243.180]) by smtp.des.no (Postfix) with ESMTP id 6F470208D; Wed, 17 Oct 2007 13:49:21 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id 559B584486; Wed, 17 Oct 2007 13:49:21 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: bv@wjv.com References: <20071016114035.O64828@lorax.ldc.upenn.edu> <20071016162948.GA79131@wjv.com> Date: Wed, 17 Oct 2007 13:49:21 +0200 In-Reply-To: <20071016162948.GA79131@wjv.com> (Bill Vermillion's message of "Tue\, 16 Oct 2007 12\:29\:48 -0400") Message-ID: <86bqayezb2.fsf@ds4.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-fs@freebsd.org, Paul Kupfer Subject: Re: du and df discrepancy X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2007 11:49:31 -0000 Bill Vermillion writes: > I've seen it many times in my XX years of Unix work. > > du - shows the amount of blocks used by the system > df - shows the amunt of space it thinks is being used. > > The latter will compute the length of sparse files so df will show > less free space than du. Sparse file will have blocks of no data in > them. These are typically created by database programs. Utterly wrong. df will show the amount of space used in the file system, including space used by files that have no directory entry (e.g. temporary files which the application unlinks immediately after opening) du will show the amount of space used by the files it is able to find by traversing the directories specified on the command line. Both will DTRT for sparse files. Note that when running 'du *' in the root of a file system, the shell will most likely not include directories and files whose names begin with a dot in its expansion of '*'. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no