

To explicitly disable HPA and DCO, use hdparm -N and hdparm -dco-restore: # hdparm -N /dev/sdx Think of it as the modern-day "low-level format" command. Including HPA, DCO, spare sectors, all drive firmware settings, etc. However, the idea is that the SECURITY ERASE command (which is handled totally by the drive firmware itself, not Linux) is supposed to erase everything possible inside the drive. I asked hdparm's creator, Mark Lord, whether ATA SECURITY ERASE wipes hidden data areas like the host protected area (HPA) and device configuration overlay (DCO) by default: The answer is manufacturer-specific, and only manufacturers know the exact details. Issuing SECURITY_DISABLE command, password="p", user=user Issuing SECURITY_UNLOCK command, password="p", user=userĪnd disable security: # hdparm -user-master u -security-disable p /dev/sdx security_password="p" Let's unlock it: # hdparm -user-master u -security-unlock p /dev/sdx security_password="p" This can be caused by the 2 hour timeout in versions prior to 9.31, for example. However, note that in such a case, Secure Erase likely did not complete successfully, leaving the drive only partially wiped. If not, you will need to disable it manually. Upon completion of step 3, security should automatically switch back to disabled. If drive is locked, unlock & disable security ***NOTE: the enhanced secure erase option is not supported by all ATA drives.

Enhanced secure erase writes predetermined data patterns (set by the manufacturer) to all user data areas, including sectors that are no longer in use due to reallocation. The difference, according to the HDDerase.exe FAQ: Secure erase overwrites all user data areas with binary zeroes.

If your drive supports enhanced erase, you may want to substitute security-erase-enhanced for security-erase. Issuing SECURITY_ERASE command, password="p", user=user Erase drive # hdparm -user-master u -security-erase p /dev/sdx security_password="p" Issuing SECURITY_SET_PASS command, password="p", user=user, mode=high
#Secure erase command password
Set password (req'd for using SE) # hdparm -user-master u -security-set-pass p /dev/sdx security_password="p" If drive is frozen, unfreeze # hdparm -I /dev/sdx.

#Secure erase command code
