Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Nov 2010 21:02:53 +0100
From:      Matthias Apitz <guru@unixarea.de>
To:        freebsd-questions@freebsd.org
Subject:   how to overwrite the content of a file
Message-ID:  <20101111200252.GA1350@tiny.Sisis.de>

next in thread | raw e-mail | index | archive | help

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 <guru@unixarea.de> - w http://www.unixarea.de/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101111200252.GA1350>