Sterilizing free space

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Tue Jan 3 18:35:22 UTC 2006


On Tue, Jan 03, 2006 at 12:42:01PM -0500, Sy Ali wrote:
> On 1/3/06, Lennart Sorensen <lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org> wrote:
> > dd if=/dev/random of=/dev/device might be good, but much slower
> > obviously.
> 
> Thanks for the tip.. I didn't realise there was another source of data
> to draw on.
> 
> If there is zero, is there some sort of "one" that exists somewhere?

Not that I know of.  Easy to write a program to do it though such as:

while :; do echo -n -e '\377'; done | dd of=/dev/device

That would write 0xFF to the device.

It would be faster than /dev/random

Something faster still might be:
export STRING=""
for i in `seq 0 1 511`; do export STRING="$STRING`echo -n -e '\0377'`"; done
while :; do echo -n -e "$STRING"; done | dd bs=512 of=/dev/device
unset $STRING

That way echo is only run once every 512bytes rather than every byte.
Should save a lot of system calls.

Repeat with some different values for overwriting as you see fit.

> Thanks for the alternate free space wiping method with dd.. I've made
> some notes and I'll try it out if I get the chance.

Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list