You are not logged in.

#1 2009-01-06 08:47:56

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

/dev/ones ?

I wanted erasing an external hard drive in safe way (not paranoid, just zeroing it) and so I used:

dd if=/dev/zero of=/dev/sdz bs=512 count=1000000

(Where 512 was the sector size and 1000000 was the number of sectors, as returned by fdisk /dev/sdz -lu)

This made me wonder, what is the best sh-wise way to fill something with a byte different than 0?
I thought this:

</dev/zero tr '\000' '\377' | dd if=/dev/stdin of=/dev/sdz bs=... count=...

Where, of course, `\377' can actually be any character, in this example it is an 'all ones'.

Is there a better ideas? And also, there can be smarter values for bs and count?

Offline

#2 2009-01-06 17:35:35

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: /dev/ones ?

he he - I never thought of using 'tr' that way, but it should work.
If I really want to scramble something, I use 'dd if=/dev/urandom' ... that might cause some headaches for possible snoopers, they _think_ that there is something valuable there and waste their time trying to figure it out :-)

As for bs/count, I don't think it matters any more, a device is just looked upon as a looooong stream of sectors that gets filled.
You _could_ use bs=4M (or something like that) to speed up the i/o somewhat.

Offline

#3 2009-01-06 18:05:34

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: /dev/ones ?

yes 'Nothing to see here, move along.' | dd if=/dev/stdin of=/dev/sdz bs=... count=...

Offline

#4 2009-01-06 22:31:58

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,549

Re: /dev/ones ?

If you ever do want to be paranoid, Darik's Boot and Nuke cannot be surpassed smile It does a very fast (optimized) single-pass zeroing too if you just want to be safe against snooping Joe Shmoes, but can do wiping higher than the standard used by the US Department of Defense. Good luck finding anything left on that drive.

It comes on the world's best rescue CD, SysRescCD.

Last edited by Ranguvar (2009-01-06 22:32:23)

Offline

Board footer

Powered by FluxBB