From owner-freebsd-questions@FreeBSD.ORG Fri Nov 12 09:05:41 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 9E724106564A for ; Fri, 12 Nov 2010 09:05:41 +0000 (UTC) (envelope-from wojtek@tensor.gdynia.pl) Received: from tensor.gdynia.pl (tensor.gdynia.pl [89.206.35.72]) by mx1.freebsd.org (Postfix) with ESMTP id E9E098FC21 for ; Fri, 12 Nov 2010 09:05:40 +0000 (UTC) Received: Received: from 127.0.0.1 (localhost [127.0.0.1]) by tensor.gdynia.pl (8.14.4/8.14.4) with ESMTP id oAC95bjP085612; Fri, 12 Nov 2010 10:05:37 +0100 (CET) (envelope-from wojtek@tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by tensor.gdynia.pl (8.14.4/8.14.4/Submit) with ESMTP id oAC95bK3085609; Fri, 12 Nov 2010 10:05:37 +0100 (CET) (envelope-from wojtek@tensor.gdynia.pl) Date: Fri, 12 Nov 2010 10:05:37 +0100 (CET) From: Wojciech Puchar To: Matthias Apitz In-Reply-To: <20101111200252.GA1350@tiny.Sisis.de> Message-ID: References: <20101111200252.GA1350@tiny.Sisis.de> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-questions@freebsd.org Subject: Re: how to overwrite the content of a file 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: Fri, 12 Nov 2010 09:05:41 -0000 dd if=/dev/zero of=file seek=x count=y bs=z conv=notrunc will overwrite y blocks of z size beginning from block x On Thu, 11 Nov 2010, Matthias Apitz wrote: > > 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/ > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > >