From owner-freebsd-chat@FreeBSD.ORG Fri Jul 13 12:03:03 2007 Return-Path: X-Original-To: freebsd-chat@FreeBSD.ORG Delivered-To: freebsd-chat@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D199416A401 for ; Fri, 13 Jul 2007 12:03:03 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.freebsd.org (Postfix) with ESMTP id 3C90C13C4C4 for ; Fri, 13 Jul 2007 12:03:03 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (dovsji@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id l6DC2tZW098522; Fri, 13 Jul 2007 14:03:01 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id l6DC2tWY098521; Fri, 13 Jul 2007 14:02:55 +0200 (CEST) (envelope-from olli) Date: Fri, 13 Jul 2007 14:02:55 +0200 (CEST) Message-Id: <200707131202.l6DC2tWY098521@lurza.secnetix.de> From: Oliver Fromme To: freebsd-chat@FreeBSD.ORG, fb-chat@psconsult.nl In-Reply-To: <20070708191144.GA37151@psconsult.nl> X-Newsgroups: list.freebsd-chat User-Agent: tin/1.8.2-20060425 ("Shillay") (UNIX) (FreeBSD/4.11-STABLE (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, 13 Jul 2007 14:03:01 +0200 (CEST) Cc: Subject: Re: compressed HDD image using dd...clearing unused blocks X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-chat@FreeBSD.ORG, fb-chat@psconsult.nl List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2007 12:03:03 -0000 Paul Schenkeveld wrote: > Michael Eubanks wrote: > Paul Schenkeveld wrote: > > > What about: > > > > > > # dd < /dev/zero > BIG_EMPTY_FILE bs=128k > > > # rm BIG_EMPTY_FILE > > > > > > Comes close to what you want, only a couple of > > > indirect blocks are > > > not zeroed this way but the majority of unused > > > blocks will be. > > > > ...snip... > > [...] > > The bs=128k is just for speed. Dd will write an incomplete block at the > end of the file to fill up just whatever space you need. If you fear > system instability, run this in single user mode. > > Oh, do a sync and wait a while between the dd and the rm to allow the > kernel some time to flush out blocks to disk, otherwise you've only > efficiently zeroed out the buffer cache :-) Are you sure? ISTR once I wrote a big file to a floppy which didn't fit. I got an error message and removed the incomplete file, but the floppy drive continued to write the blocks from the cache. I think the buffer cache works on block level, not on file level, so the syncing and waiting shouldn't be necessary. The zeroed data blocks schould still be written to disk, even after the directory entry has been unlinked. Besides, the buffer cache is certainly _much_ smaller than the hard disk in question, so the majority of blocks has already been zeroed on disk when the dd command finishes. Best regards Oliver -- 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 "Perl will consistently give you what you want, unless what you want is consistency." -- Larry Wall