Skip to content

Instantly share code, notes, and snippets.

@gregjhogan
Created July 3, 2021 17:56
Show Gist options
  • Save gregjhogan/90bd89be2130a8179418223fdc4705bb to your computer and use it in GitHub Desktop.
Save gregjhogan/90bd89be2130a8179418223fdc4705bb to your computer and use it in GitHub Desktop.
hdparm secure erase hard drive
DISK_DEV=/dev/sd<?>
DISK_PWD="" # leave empty or set to something you will remember
sudo hdparm --user-master u --security-set-pass "$DISK_PWD" $DISK_DEV
sudo hdparm --user-master u --security-erase-enhanced "$DISK_PWD" $DISK_DEV
# secure erase should clear user password and disable security when complete
#sudo hdparm --user-master u --security-disable "$DISK_PWD" $DISK_DEV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment