Re: Complete Wiping of a hard drive
"Russell Evans" <[email protected]>
| Newsgroups | gmane.org.user-groups.linux.pdxlug |
|---|---|
| Message-ID | <20040613162442.447c7ef6@downtown> |
On Sun, 06 Jun 2004 13:11:36 -0700 "Richard Steffens" <[email protected]> wrote: > Thanks for all the advice. > > Turns out, my friend wanted to keep the OS intact (WinME). I have a > copy of Norton System Works 2000. So, I ran WIPEINFO to write 0's to > all the free space, after deleting all the data files and emptying the > trash. She was happy with that. > Assuming you can mount the partition read/write. then this is a simple bash script to zero the free space on a hard drive. #!/bin/sh ARRAY=(`df | awk '/^\//{ if ( $6 ) { print $1 ; print $3 ; print $6 } else { print $1 ; getline ; print $3 ; print $5 } }'`) let x=0 while [ $x -lt ${#ARRAY[@]} ] ; do let y=$x+1 let z=$x+2 if [ "${ARRAY[$z]}" = "/" ] ; then ARRAY[$z]="" fi SIZE=${ARRAY[$y]} PARTITION=${ARRAY[$z]} echo "Working on ${ARRAY[$x]}" eval dd if=/dev/zero of=${PARTITION}/0bits bs=$SIZE if [ $? = 0 ] ; then rm ${ARRAY[$z]}/0bits let x=$x+3 else echo opps exit 1 fi done