How to unlock an ATA password-locked HDD with an upper-case password if the BIOS accepts only lower-case?

I accidentally locked an HDD with an ATA password, trying to issue a secure erase command. It was on Linux, I entered this command :

# hdparm --security-erase PWD /dev/sda

So the password is PWD (no need to keep it secret as it doesn't protect anything). Fine. But now the drive is locked, the BIOS asks for the password when I boot with the drive plugged, "PWD" doesn't work, and I think I found why : the BIOS accepts only lower-case letters.

I tried to remove the drive, boot on a live USB (Fedora) and plug the HDD, but the system doesn't recognize the drive. And I can't boot with the drive plugged : the BIOS won't even let me in the setup screen to boot on the USB stick, without the ATA password.

How can I unlock it if I know the password but the BIOS doesn't accept it ?


Solution 1:

This is a "feature" of many BIOS implementations. Fortunately, the ATA security spec is only enforced by the BIOS, not the drive itself. That means if you can get around the BIOS, you can access the drive.

Please note, a USB enclosure may not work. Issuing ATA commands to a SATA drive in a USB enclosure may fail. It depends on whether or not the USB controller in the enclosure will reject the commands.

Here's a better way:

  1. Burn yourself a Linux Live CD or make a bootable Linux USB flash drive. There are many tools and ISOs available on the Internet for this.
  2. With the computer turned off, unhook the SATA cable from the affected hard drive.
  3. With the SATA cable disconnected, power the computer up and boot from the CD or flash drive you made in step 1.
  4. Once the system has booted, reconnect the SATA cable to the hard drive. This is called hot-plugging.
  5. IF your laptop supports SATA hot-plugging (some don't), then your hard drive will become available and you can use hdparm to remove the password from the drive.

If your laptop does not support SATA hotplugging, then this trick will have to be performed on another computer -- preferably a desktop, since desktops are usually more standards-compliant than laptops are.

Also, the SATA controller must be set to AHCI for this to work. IDE or RAID modes will fail.

Solution 2:

I succeeded by plugging the drive in an old PC and issuing hdparm --security-disable PWD /dev/sdb. The drive is now reusable.

Note that the command above will completely disable the ATA password. If you only want to unlock the drive, use hdparm --security-unlock PWD /dev/sdb instead