Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Nov 2010 14:16:33 -0600
From:      Adam Vande More <amvandemore@gmail.com>
To:        Matthias Apitz <guru@unixarea.de>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: how to overwrite the content of a file
Message-ID:  <AANLkTind2VkJdM%2BkdTDBWuHXs5KCpN0DhaCS22Xg9HFn@mail.gmail.com>
In-Reply-To: <20101111200252.GA1350@tiny.Sisis.de>
References:  <20101111200252.GA1350@tiny.Sisis.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 11, 2010 at 2:02 PM, Matthias Apitz <guru@unixarea.de> wrote:

> 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?
>

Well there is "rm -P" although I'm not sure that accomplished exactly what
you are looking for.

-- 
Adam Vande More



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTind2VkJdM%2BkdTDBWuHXs5KCpN0DhaCS22Xg9HFn>