From owner-freebsd-questions@FreeBSD.ORG Thu Nov 11 20:02:27 2010 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 CBB5C1065672 for ; Thu, 11 Nov 2010 20:02:27 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms16-1.1blu.de (ms16-1.1blu.de [89.202.0.34]) by mx1.freebsd.org (Postfix) with ESMTP id 86CFB8FC0C for ; Thu, 11 Nov 2010 20:02:27 +0000 (UTC) Received: from [109.85.146.94] (helo=tiny.Sisis.de.) by ms16-1.1blu.de with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1PGdLk-0007hG-QO for freebsd-questions@freebsd.org; Thu, 11 Nov 2010 21:02:25 +0100 Received: from tiny.Sisis.de. (localhost [127.0.0.1]) by tiny.Sisis.de. (8.14.3/8.14.3) with ESMTP id oABK2sL2001428 for ; Thu, 11 Nov 2010 21:02:54 +0100 (CET) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by tiny.Sisis.de. (8.14.3/8.14.3/Submit) id oABK2r80001427 for freebsd-questions@freebsd.org; Thu, 11 Nov 2010 21:02:53 +0100 (CET) (envelope-from guru@unixarea.de) X-Authentication-Warning: tiny.Sisis.de.: guru set sender to guru@unixarea.de using -f Date: Thu, 11 Nov 2010 21:02:53 +0100 From: Matthias Apitz To: freebsd-questions@freebsd.org Message-ID: <20101111200252.GA1350@tiny.Sisis.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: FreeBSD 8.0-CURRENT (i386) User-Agent: Mutt/1.5.19 (2009-01-05) X-Con-Id: 51246 X-Originating-IP: 109.85.146.94 Subject: how to overwrite the content of a file X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Matthias Apitz List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Nov 2010 20:02:27 -0000 Hello, What is the best method to overwrite the blocks of a given file with bytes of 0x00, i.e. not to O_TRUNC away the blocks to the freelist of the file system, but overwrite the old blocks? I've checked $ dd if=/dev/zero of=file count=4 but dd(1) opens the file with O_RDWR|O_CREAT|O_TRUNC which for sure will give away the old blocks and adquire new blocks. Any idea? The background of the question is that I want to make sure, that certain content is not placed into a dump of the file system before give away the output of the dump(8). Thanks matthias -- Matthias Apitz t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211 e - w http://www.unixarea.de/