Original Article: https://wiki.archlinux.org/index.php/SSD_memory_cell_clearing
Step 1 – Make sure the drive security is not frozen
Issue the following command:
# hdparm -I /dev/sdX
Step 2 – Enable security by setting a user password
Any password will do, as this should only be temporary. After the secure erase the password will be set back to NULL. In this example, the password is “PasSWorD” as shown:
# hdparm --user-master u --security-set-pass PasSWorD /dev/sdX security_password="PasSWorD" /dev/sdX: Issuing SECURITY_SET_PASS command, password="PasSWorD", user=user, mode=high
As a sanity check, issue the following command
# hdparm -I /dev/sdX
The command output should display “enabled”:
Security:
Master password revision code = 65534
supported
enabled
not locked
not frozen
not expired: security count
supported: enhanced erase
Security level high
2min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT.
Step 3 – Issue the ATA Secure Erase command
# hdparm --user-master u --security-erase PasSWorD /dev/sdX
Wait until the command completes. This example output shows it took about 40 seconds for an Intel X25-M 80GB SSD.
security_password="PasSWorD" /dev/sdX: Issuing SECURITY_ERASE command, password="PasSWorD", user=user 0.000u 0.000s 0:39.71 0.0% 0+0k 0+0io 0pf+0w
The drive is now erased. After a successful erasure the drive security should automatically be set to disabled (thus no longer requiring a password for access). Verify this by running the following command:
# hdparm -I /dev/sdX
The command output should display “not enabled”:
Security:
Master password revision code = 65534
supported
not enabled
not locked
not frozen
not expired: security count
supported: enhanced erase
2min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT.