shred vs writing zeros to wipe a drive

Eric Cope eric.cope at gmail.com
Mon Aug 19 15:17:13 MST 2013


Sparkfun to the rescue! https://www.sparkfun.com/tutorials/132


On Mon, Aug 19, 2013 at 1:40 PM, Matt Graham <mhgraham at crow202.org> wrote:

> On 2013-08-19 10:39, Carruth, Rusty wrote:
>
>> Don't' know if I need to see the code, but I'm certainly curious to know
>> how you made it slightly more efficient :-)
>>
>
> If you do "dd if=/dev/zero of=/dev/sdb bs=32k" , then dd is constantly
> reading from /dev/zero .  Sure, reading from /dev/zero is fast, but
>
> zeroes=calloc(1,32768*sizeof(**char));
> /* later */
> fwrite(zeroes,32768,1,WRITE_**PTR);
>
> doesn't do *any* I/O to /dev/zero .
>
> When doing the "write random data" pass, randbuffer contains 32K of data
> read from /dev/urandom .  After the data is written, randbuffer is only
> rewritten with new random data if rand() % 2 == 0.  This means that there's
> 50% less I/O to /dev/urandom at the price of having the random data
> repeated for more than 1 block in a mostly non-deterministic way.  Which
> means the program spends more time writing and less time reading.
>
>  I figure /dev/urandom is at least one order of magnitude better
>> than /dev/zero (in some base or other) :-) But, yes, if you REALLY
>> want good random numbers use /dev/random and be prepared for a wait.
>>
>
> If you need more than about 256 bytes of stuff out of /dev/random, you'll
> be waiting for a looooong time.  At least IME.  If you have serious needs
> for lots of high-quality non-deterministic entropy, I guess you build an
> RNG made out of the beta emitters in old smoke detectors.  (Fun for the
> whole family! :-) )
>
> --
> Crow202 Blog: http://crow202.org/wordpress
> There is no Darkness in Eternity
> But only Light too dim for us to see.
> ------------------------------**---------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.**org<PLUG-discuss at lists.phxlinux.org>
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/**mailman/listinfo/plug-discuss<http://lists.phxlinux.org/mailman/listinfo/plug-discuss>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20130819/0fcc6b88/attachment.html>


More information about the PLUG-discuss mailing list