#!/usr/bin/env bash # # This is dangerous!! # # Seriously! # # Use hdparam to securely erase a hard drive... yes. all gone. # # Author: Mark Ruff # Date: ?? # # Revision: 29 Dec 2015 # Uses command line arg to get device to erase # # Seriously - be careful. Like chmod a-x just to be safe # check command line arg - should only be one. the block device to erase if [ $# -ne 1 ] then echo "please supply a device to secure erase: /dev/xxx" exit 1 elif ! [ -b $1 ] then echo "$1 is not a block device" exit 2 fi # check we really want to do this! echo "Are you sure you want to completely erase $1? (yes|no): " read RESPONSE if [ $RESPONSE != "yes" ] then echo "Phew..." exit 10 fi echo "Are you REALLY sure you want to do this?! (YES|no): " read RESPONSE if [ $RESPONSE != "YES" ] then echo "That was close..." exit 11 fi # secure erase o.O sudo hdparm --user-master u --security-set-pass p $1 sudo hdparm --user-master u --security-erase-enhanced p $1 &
Comments