Marius van Witzenburg We fight for our survival, we fight!

9Jun/110

How to DoD 5220.22-M secure wipe a disk

If you need to trash a disk its always smart to first erase all your data in a way others cannot recover it easily.

This script is a nice way to wipe it on a DoD 5220.22-M compatible way.

!/bin/sh
 
if [ -z "$1" ]
then
    echo "Usage: $0 ad1"
    exit    
fi
 
doExit() {
    exit $? 
}
trap doExit SIGINT
 
confirmed=0
for n in 1 2 3 4 5 6 7 
do
    if [ -c "/dev/$1" ]
    then    
        if [ "$confirmed" -eq 0 ] 
        then    
            echo "Erase /dev/$1 ?"
            read -e confirm 
        fi      
        if [ "$confirm" = "yes" ] 
        then    
            confirmed=1
            /bin/dd if=/dev/urandom of=/dev/$1 bs=8b
        else    
            echo "Be careful!"
            exit    
        fi      
    else    
        echo "Device not found!"
        exit    
    fi
done

Posted by mariusvw

Reacties (0) Trackbacks (0)

Nog geen reacties


Leave a comment

(required)

Nog geen trackbacks.