How to simulate /dev/one functionality
From Wiki-UX.info
Abstract
Use of /dev/zero to write one layer of zeros is common, however we may wants three layers of garbage on the drive; layer of zero, than a layer of ones, then another layer of zeros.
Wiping Disks
# cat /dev/zero | tr '\000' '\001' | dd of=/dev/rdsk/cxxxxx bs=64k If you are nit-picky, using <tt>'''tr '\000' '\001''''</tt> only flips 1 bit whereas a <tt>'''tr '\000' '\377''''</tt> flips every bit. There appears to be a bug in tr in that it behaves differently if reading input from a pipe. cat /dev/zero | tr '\0' '\377' is broken but tr '\0' '\377' < /dev/zero works perfectly (and is more efficient to boot).
Flip bits to 1
This command should work AND flip all your bits to '1'.
tr '\0' '\377' < /dev/zero | dd bs=64k of=/dev/rdsk/cXtYdZ
Random Data
In case that random data, instead 0s or 1s are required, the following perl code may emulate a random generator:
perl -e 'srand(time() ^ $$); while (1) { print chr(int(rand() * 255)); }' |\ dd of=/var/tmp/test.dd bs=2k count=10
Reference
PDF of forum "Wiping Disks: more than /dev/zero" : Media:Devzero.pdf
Editors/Authors
- Editor Scott Marer