From owner-freebsd-stable@FreeBSD.ORG Fri Jun 20 20:48:45 2008 Return-Path: Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BF081065673 for ; Fri, 20 Jun 2008 20:48:44 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (unknown [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 4797C8FC13 for ; Fri, 20 Jun 2008 20:48:44 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.1/8.14.1) with ESMTP id m5KKmgDs073727; Fri, 20 Jun 2008 22:48:42 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.1/8.14.1/Submit) id m5KKmgo6073726; Fri, 20 Jun 2008 22:48:42 +0200 (CEST) (envelope-from olli) Date: Fri, 20 Jun 2008 22:48:42 +0200 (CEST) Message-Id: <200806202048.m5KKmgo6073726@lurza.secnetix.de> From: Oliver Fromme To: freebsd-stable@FreeBSD.ORG In-Reply-To: X-Newsgroups: list.freebsd-stable User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.2-STABLE-20070808 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Fri, 20 Jun 2008 22:48:42 +0200 (CEST) Cc: Subject: Re: Incorrect file size? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2008 20:48:45 -0000 Ivan Voras wrote: > Rink Springer wrote: > > The 'vscan' user leads me assume this is SpamAssassin - I've seen this > > behaviour at work, where our scripts were trying to backup a 1TB file > > (which actually was ~vscan/.spamassassin/auto-whitelist). The result was > > that the backup script died due to lack of disk space on the backup > > server (as we don't use compression). > > > > When I was investigating why the file could be so large it, it turned > > out the file was only a few hunderd 'real' MB's, so that is why I assume > > this person is having the same issue as we do. The file is a Berkeley DB > > file, by the way, so there's nothing textfile about it ;-) > > I learn something every day :) > Didn't know BDB was smart enough to create sparse files. BTW, you can use "ls -ls" to display the number of physical blocks allocated to the file, so you can easily see whether a file is sparse or not: $ dd if=/dev/zero of=foo1 bs=1m count=1 $ truncate -s 1m foo2 $ ls -ls foo1 foo2 1040 -rw------- 1 olli olli 1048576 Jun 20 22:43 foo1 32 -rw------- 1 olli olli 1048576 Jun 20 22:43 foo2 As you can see, the file size is the same, but the block counts are different (I have BLOCKSIZE=K in my environment, so the blocks are displayed in 1KB units). I've written a small script that can be used to detect sparse files (it even displays the "sparseness" percentage): http://www.secnetix.de/olli/scripts/sparsecheck Best regards Oliver PS: Of course it is still possible that a file system is corrupt and needs fsck, no matter whether those files are sparse or not. -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "C++ is over-complicated nonsense. And Bjorn Shoestrap's book a danger to public health. I tried reading it once, I was in recovery for months." -- Cliff Sarginson