SurlyJake Blog

Write Zero's to Disk Infinite Loop

| Comments

I was bored… So this is a little bash script i wrote that will write zero’s to a hard disk infinately until you press CTRL+C. It uses dcfldd instead of plain dd because i like the progress output it provides.

#!/bin/bash
echo -e "Which disk would you like to wipe out? (sda, sdb, sdc)?   \c"
read DISK
read -p "You picked "$DISK", are you sure? (y/n)" -n 1
if [[ $REPLY =~ ^[Yy]$ ]]
then
C=1
for (( ; ; ))
do
        echo -e "\nStarting zero Sweep number "$C" ..."
        dcfldd if=/dev/zero of=/dev/$DISK
        echo "Zero's written to Disk "$C" time(s)"
        echo "[ hit CTRL+C to stop ]"
        let C=C+1
done
fi

Comments