Linux – hdparm unlock ssd with correct password encoding

hard drivehardwarehdparmlinuxssd

I have an old password protected SSD connected via USB to my Linux System. I'm trying to unlock it with hdparm.

Problem is my password was ./perspective (it doesn't matter now because I only used it for the SSD and nowhere else) and I think because of the special characters ./ and their wrong encoding I now can't unnlock the drive with

hdparm --user-master u --security-unlock ./perspective /dev/sdc
........................................
  security_password: "./perspective"

/dev/sdc:
 Issuing SECURITY_UNLOCK command, password="./perspective", user=user
SECURITY_UNLOCK: Input/output error

According to this post I have to use 'Hex Scan Codes'
for special characters. So I tried

hdparm --user-master u --security-unlock $(printf '\x34\x35\x19\x12\x13\x1F\x19\x12\x2E\x14\x17\x2F\x12') /dev/sdc
........................................
security_password: "45./"

/dev/sdc:
 Issuing SECURITY_UNLOCK command, password="45./", user=user
SECURITY_UNLOCK: Input/output error

hdparm -I /dev/sdc gives me

/dev/sdc:

ATA device, with non-removable media
    Model Number:       ADATA SP900                             
    Serial Number:      2D3020001288        
    Firmware Revision:  5.0.7a  
    Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
    Used: unknown (minor revision code 0x0110) 
    Supported: 8 7 6 5 
    Likely used: 8
Configuration:
    Logical     max current
    cylinders   16383   16383
    heads       16  16
    sectors/track   63  63
    --
    CHS current addressable sectors:   16514064
    LBA    user addressable sectors:  250069680
    LBA48  user addressable sectors:  250069680
    Logical  Sector size:                   512 bytes
    Physical Sector size:                   512 bytes
    Logical Sector-0 offset:                  0 bytes
    device size with M = 1024*1024:      122104 MBytes
    device size with M = 1000*1000:      128035 MBytes (128 GB)
    cache/buffer size  = unknown
    Nominal Media Rotation Rate: Solid State Device
Capabilities:
    LBA, IORDY(can be disabled)
    Queue depth: 32
    Standby timer values: spec'd by Standard, no device specific minimum
    R/W multiple sector transfer: Max = 16  Current = 16
    Advanced power management level: 254
    DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
         Cycle time: min=120ns recommended=120ns
    PIO: pio0 pio1 pio2 pio3 pio4 
         Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
    Enabled Supported:
       *    SMART feature set
       *    Security Mode feature set
       *    Power Management feature set
       *    Write cache
            Look-ahead
       *    Host Protected Area feature set
       *    WRITE_BUFFER command
       *    READ_BUFFER command
       *    NOP cmd
       *    DOWNLOAD_MICROCODE
       *    Advanced Power Management feature set
            Power-Up In Standby feature set
       *    SET_FEATURES required to spinup after power up
       *    48-bit Address feature set
       *    Mandatory FLUSH_CACHE
       *    FLUSH_CACHE_EXT
       *    SMART error logging
       *    SMART self-test
       *    General Purpose Logging feature set
       *    WRITE_{DMA|MULTIPLE}_FUA_EXT
       *    64-bit World wide name
       *    IDLE_IMMEDIATE with UNLOAD
            Write-Read-Verify feature set
       *    {READ,WRITE}_DMA_EXT_GPL commands
       *    Segmented DOWNLOAD_MICROCODE
       *    Gen1 signaling speed (1.5Gb/s)
       *    Gen2 signaling speed (3.0Gb/s)
       *    Gen3 signaling speed (6.0Gb/s)
       *    Native Command Queueing (NCQ)
       *    Host-initiated interface power management
       *    Phy event counters
       *    Device automatic Partial to Slumber transitions
       *    READ_LOG_DMA_EXT equivalent to READ_LOG_EXT
            DMA Setup Auto-Activate optimization
            Device-initiated interface power management
       *    Software settings preservation
       *    SMART Command Transport (SCT) feature set
       *    SCT Data Tables (AC5)
       *    SET MAX SETPASSWORD/UNLOCK DMA commands
       *    Data Set Management TRIM supported (limit 1 block)
       *    Deterministic read data after TRIM
Security: 
    Master password revision code = 22616
        supported
        enabled
        locked
    not frozen
    not expired: security count
    not supported: enhanced erase
    Security level high
    2min for SECURITY ERASE UNIT. 
Logical Unit WWN Device Identifier: 0000000000000000
    NAA     : 0
    IEEE OUI    : 000000
    Unique ID   : 000000000
Checksum: correct

PS: Please don't mark as duplicate with this question since I'm mostly interested in finding the right encoding for my password and no Master Password from the answer there matched my device.

Best Answer

Try hdparm --user-master m --security-unlock NULL /dev/something

Back story: I have a SX900 with the same 5.0.7a firmware version. After using ADATA Toolbox to secure erase the drive and rebooting when told I ended up with a password locked drive. ADATA actually has a chapter in the manual for their program about this happening with the helpful advice Use a third-party tool to unlock and Unlock Password: ADATA. Only I don't know what the program actually sends but the drive won't accept --user-master u --security-unlock ADATA. I almost gave up on the drive until on a whim I tried a blank master password.

I'm mostly replying to this so when I soft brick this drive again I'll be able to google my past answer :V

Related Topic