These steps must be performed as root, where $device is your device, e.g. /dev/sda
  1. hdparm -I $device and check device:
  2. not frozen
  3. if frozen, suspend/sleep and then wake (if running ubuntu live cd, make a note of the username, e.g. ubuntu-studio, before this so that you can unlock)
  4. supports enhanced erase
  5. Set user password: hdparm --user-master u --security-set-pass MrFlibble $device
  6. Security erase: hdparm --user-master u --security-erase MrFlibble $device
  7. Check drive status hdparm -I $device, should be not locked

(Summarised from