Skip to content

Instantly share code, notes, and snippets.

@Apkawa
Created March 19, 2013 13:23
Show Gist options
  • Save Apkawa/5196062 to your computer and use it in GitHub Desktop.
Save Apkawa/5196062 to your computer and use it in GitHub Desktop.
HDD=$1
BUFFER_SIZE=$(hdparm -i /dev/sda|grep -Po 'BuffSize=.*kB,'|sed -e 's/BuffSize=//' -e 's/kB,//')
echo "Start clean hdd $HDD"
CLEAN_CMD="dd if=/dev/random of=$HDD bs=${BUFFER_SIZE}kB"
for i in 1 2
do
echo $CLEAN_CMD
$CLEAN_CMD
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment