Ubuntu ata secure erase

From richud.com
Jump to navigation Jump to search


BIOS ATA Erase Drive

  • Suggest reading this first....

Read this first for full story

Use the drives inbuilt BIOS function to securely erase it.


Check if frozen

You need to have the drive NOT frozen

sudo hdparm -I /dev/sdX

This wont work...it is frozen

Security: 
	Master password revision code = 65534
		supported
	not	enabled
	not	locked
		frozen
	not	expired: security count
		supported: enhanced erase
 ....snip....

To unfreeze you can try ;

1) Hotplug the drive if you have the board in AHCI node (not IDE)

i.e. boot machine then plug drive to wipe in. Not all boards will show the drive up even in AHCI mode though.

OR

2) Suspend the pc, then unsuspend it - this command will suspend it....

sudo -i
echo -n mem > /sys/power/state

If you are lucky it will now be unfrozen when you hit power button to unsleep it.

Yay it's unfrozen....

Security: 
	Master password revision code = 65534
		supported
	not	enabled
	not	locked
	not	frozen
	not	expired: security count
		supported: enhanced erase
...snip....

Otherwise read the first link as it suggests some rather more unlikely possibilities. One of the above two choices usually work though.

Example - Erase secondary drive /dev/sdb

Assuming it is now unfrozen....you need to first set a password before you can erase it, yes really.

1234 is the password here, but can be anything, don't use NULL !

sudo hdparm --security-set-pass 1234 /dev/sdb
sudo hdparm --security-erase 1234 /dev/sdb
$ sudo hdparm --security-set-pass 1234 /dev/sda
security_password: "1234"

/dev/sda:
 Issuing SECURITY_SET_PASS command, password="1234", user=user, mode=high

$ sudo hdparm --security-erase 1234 /dev/sda
security_password: "1234"

/dev/sda:
 Issuing SECURITY_ERASE command, password="1234", user=user

...then when it finishes, it may be immediately available blanked or you may need to reboot or unplug it.

(don't worry , password will now be gone , removed at end of erase.)