Operating System - HP-UX
1832993 Members
3956 Online
110048 Solutions
New Discussion

Wiping Disks: more than /dev/zero ...

 
SOLVED
Go to solution
Robert Gamble
Respected Contributor

Re: Wiping Disks: more than /dev/zero ...

AUUGH!

Now that 'we' solved the /dev/one issue, now management wants a layer of random characters.

Now, I could probably use the following expression to generate random numbers, but I'm not sure how to use it as an input for 'dd':
((num=RANDOM %10 +1)); print $num

I'm sure someone with better scripting skills than I could figure some useful command line.

Thanks in advance !
A. Clay Stephenson
Acclaimed Contributor

Re: Wiping Disks: more than /dev/zero ...

Hi Robert:

This should blow the doors off of anything you can do in the shell:


perl -e 'srand(time() ^ $$); while (1) { print chr(int(rand() * 255)); }' | dd bs=8k of=/dev/rdsk/cXtYdZ

If it ain't broke, I can fix that.
Frank Slootweg
Honored Contributor

Re: Wiping Disks: more than /dev/zero ...

To all,

If you haven't already done so, then test if your proposed solution is *fast enough* (to wipe a disk)?

Why? Well, I came up with The Perfect Method (tm), which did use standard HP-UX commands, i.e. no /dev/zero with its associated problems, no 'fancy' perl, etc., *BUT*, before posting it, I actually tested it for a few megabytes of data and it was dog/too slow, 44 *seconds*/MB.

Robert Gamble
Respected Contributor

Re: Wiping Disks: more than /dev/zero ...

Frank,

For each 4GB disk I was wiping, each pass of ones or zeros took 7 minutes. I am about to try the perl line Clay provided. I'll post the entire procedure and time it takes once complete.

Frank Slootweg
Honored Contributor

Re: Wiping Disks: more than /dev/zero ...

I am sorry for not being clear.

The 44 seconds/MB 'speed' I mentioned was the 'speed' of only the data source, i.e. sending the output from the data source to /dev/null, i.e. *without* the time needed for actually writing_to/wiping the disk..

Robert Gamble
Respected Contributor

Re: Wiping Disks: more than /dev/zero ...

Ok. Got a procedure I plan to use, without a layer of random data.

I wrote a shell script that requires the cXtYdZ disk indentifier as an agruement. This script assumes /dev/zero exists.

#!/bin/sh
date
echo "Starting first pass now ..."
dd if=/dev/zero of=/dev/rdsk/$1 bs=8k
date
echo "33% done"
tr '\0' '\377' < /dev/zero | dd of=/dev/rdsk/$1 bs=8k
date
echo " 66% done"
dd if=/dev/zero of=/dev/rdsk/$1 bs=8k
echo "Wipe is complete."
date

This took an average of 22 minutes to complete on 4GB drives.

I got them to back off on the random characters. Thanks anyway Clay!

Thank you "Team ITRC" !!