Password-locked disks

From FnordWiki
Jump to navigation Jump to search

Received a batch used of Toshiba SSDs from an eBay auction. So let's see what's on them...

itops@warthog-1:~$ time sudo strings -a /dev/sda 

real	0m1.396s
user	0m0.007s
sys	0m0.008s
itops@warthog-1:~$ 

So we read half a Tbyte in 1.4 seconds? That seems a bit ... beyond the capabilities of current storage technology. Let's see what the kernel has to say about this...

[Sun Sep 11 16:04:22 2022] scsi 0:0:4:0: Direct-Access     ATA      TOSHIBA THNSNJ51 0102 PQ: 0 ANSI: 6
[Sun Sep 11 16:04:22 2022] scsi 0:0:4:0: SATA: handle(0x000d), sas_addr(0x4433221103000000), phy(3), device_name(0x0000000000000000)
[Sun Sep 11 16:04:22 2022] scsi 0:0:4:0: enclosure logical id (0x590b11c022402d00), slot(0) 
[Sun Sep 11 16:04:22 2022] scsi 0:0:4:0: atapi(n), ncq(y), asyn_notify(n), smart(y), fua(y), sw_preserve(y)
[Sun Sep 11 16:04:22 2022] scsi 0:0:4:0: qdepth(32), tagged(1), scsi_level(7), cmd_que(1)
[Sun Sep 11 16:04:24 2022] sd 0:0:4:0: Attached scsi generic sg1 type 0
[Sun Sep 11 16:04:24 2022]  end_device-0:4: add: handle(0x000d), sas_addr(0x4433221103000000)
[Sun Sep 11 16:04:24 2022] sd 0:0:4:0: Power-on or device reset occurred
[Sun Sep 11 16:04:26 2022] sd 0:0:4:0: [sda] 1000215216 512-byte logical blocks: (512 GB/477 GiB)
[Sun Sep 11 16:04:26 2022] sd 0:0:4:0: [sda] Write Protect is off
[Sun Sep 11 16:04:26 2022] sd 0:0:4:0: [sda] Mode Sense: 7f 00 10 08
[Sun Sep 11 16:04:26 2022] sd 0:0:4:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
[Sun Sep 11 16:04:31 2022] sd 0:0:4:0: [sda] tag#2072 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:31 2022] sd 0:0:4:0: [sda] tag#2072 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:31 2022] sd 0:0:4:0: [sda] tag#2072 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:31 2022] sd 0:0:4:0: [sda] tag#2072 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:04:31 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:31 2022] Buffer I/O error on dev sda, logical block 0, async page read
[Sun Sep 11 16:04:31 2022] sd 0:0:4:0: [sda] tag#2045 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:31 2022] sd 0:0:4:0: [sda] tag#2045 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:32 2022] sd 0:0:4:0: [sda] tag#2045 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:32 2022] sd 0:0:4:0: [sda] tag#2045 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:04:32 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:32 2022] Buffer I/O error on dev sda, logical block 0, async page read
[Sun Sep 11 16:04:32 2022] sd 0:0:4:0: [sda] tag#2022 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:32 2022] sd 0:0:4:0: [sda] tag#2022 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:32 2022] sd 0:0:4:0: [sda] tag#2022 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:32 2022] sd 0:0:4:0: [sda] tag#2022 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:04:32 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:33 2022] Buffer I/O error on dev sda, logical block 0, async page read
[Sun Sep 11 16:04:33 2022] sd 0:0:4:0: [sda] tag#2055 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:33 2022] sd 0:0:4:0: [sda] tag#2055 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:33 2022] sd 0:0:4:0: [sda] tag#2055 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:33 2022] sd 0:0:4:0: [sda] tag#2055 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:04:33 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:33 2022] Buffer I/O error on dev sda, logical block 0, async page read
[Sun Sep 11 16:04:33 2022] ldm_validate_partition_table(): Disk read failed.
[Sun Sep 11 16:04:34 2022] sd 0:0:4:0: [sda] tag#1992 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:34 2022] sd 0:0:4:0: [sda] tag#1992 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:34 2022] sd 0:0:4:0: [sda] tag#1992 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:34 2022] sd 0:0:4:0: [sda] tag#1992 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:04:34 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:34 2022] Buffer I/O error on dev sda, logical block 0, async page read
[Sun Sep 11 16:04:34 2022] sd 0:0:4:0: [sda] tag#2056 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:34 2022] sd 0:0:4:0: [sda] tag#2056 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:35 2022] sd 0:0:4:0: [sda] tag#2056 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:35 2022] sd 0:0:4:0: [sda] tag#2056 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:04:35 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:35 2022] Buffer I/O error on dev sda, logical block 0, async page read
[Sun Sep 11 16:04:35 2022] sd 0:0:4:0: [sda] tag#1993 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:35 2022] sd 0:0:4:0: [sda] tag#1993 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:35 2022] sd 0:0:4:0: [sda] tag#1993 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:35 2022] sd 0:0:4:0: [sda] tag#1993 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:04:35 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:36 2022] Buffer I/O error on dev sda, logical block 0, async page read
[Sun Sep 11 16:04:36 2022] sd 0:0:4:0: [sda] tag#2057 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:36 2022] sd 0:0:4:0: [sda] tag#2057 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:36 2022] sd 0:0:4:0: [sda] tag#2057 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:36 2022] sd 0:0:4:0: [sda] tag#2057 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:04:36 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:36 2022] Buffer I/O error on dev sda, logical block 0, async page read
[Sun Sep 11 16:04:36 2022] Dev sda: unable to read RDB block 0
[Sun Sep 11 16:04:37 2022] sd 0:0:4:0: [sda] tag#1994 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:37 2022] sd 0:0:4:0: [sda] tag#1994 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:37 2022] sd 0:0:4:0: [sda] tag#1994 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:37 2022] sd 0:0:4:0: [sda] tag#1994 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:04:37 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:37 2022] Buffer I/O error on dev sda, logical block 0, async page read
[Sun Sep 11 16:04:37 2022] sd 0:0:4:0: [sda] tag#1988 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:37 2022] sd 0:0:4:0: [sda] tag#1988 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:38 2022] sd 0:0:4:0: [sda] tag#1988 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:38 2022] sd 0:0:4:0: [sda] tag#1988 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:04:38 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:38 2022] Buffer I/O error on dev sda, logical block 0, async page read
[Sun Sep 11 16:04:38 2022] sd 0:0:4:0: [sda] tag#1989 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:38 2022] sd 0:0:4:0: [sda] tag#1989 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:38 2022] sd 0:0:4:0: [sda] tag#1989 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:38 2022] sd 0:0:4:0: [sda] tag#1989 CDB: Read(10) 28 00 00 00 00 18 00 00 08 00
[Sun Sep 11 16:04:38 2022] blk_update_request: I/O error, dev sda, sector 24 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:39 2022] Buffer I/O error on dev sda, logical block 3, async page read
[Sun Sep 11 16:04:39 2022] sd 0:0:4:0: [sda] tag#1990 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:39 2022] sd 0:0:4:0: [sda] tag#1990 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:39 2022] sd 0:0:4:0: [sda] tag#1990 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:39 2022] sd 0:0:4:0: [sda] tag#1990 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:04:39 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:39 2022] Buffer I/O error on dev sda, logical block 0, async page read
[Sun Sep 11 16:04:39 2022]  sda: unable to read partition table
[Sun Sep 11 16:04:40 2022] sd 0:0:4:0: [sda] tag#1995 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:40 2022] sd 0:0:4:0: [sda] tag#1995 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:40 2022] sd 0:0:4:0: [sda] tag#1995 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:40 2022] sd 0:0:4:0: [sda] tag#1995 CDB: Read(10) 28 00 3b 9e 12 00 00 00 08 00
[Sun Sep 11 16:04:40 2022] blk_update_request: I/O error, dev sda, sector 1000215040 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
[Sun Sep 11 16:04:41 2022] sd 0:0:4:0: [sda] tag#1997 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:04:41 2022] sd 0:0:4:0: [sda] tag#1997 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:04:41 2022] sd 0:0:4:0: [sda] tag#1997 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:04:41 2022] sd 0:0:4:0: [sda] tag#1997 CDB: Read(10) 28 00 3b 9e 12 00 00 00 08 00
[Sun Sep 11 16:04:41 2022] blk_update_request: I/O error, dev sda, sector 1000215040 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:04:41 2022] Buffer I/O error on dev sda, logical block 125026880, async page read
[Sun Sep 11 16:04:43 2022] sd 0:0:4:0: [sda] Attached SCSI disk
[Sun Sep 11 16:05:50 2022] sd 0:0:4:0: [sda] tag#2086 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:05:50 2022] sd 0:0:4:0: [sda] tag#2086 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:05:51 2022] sd 0:0:4:0: [sda] tag#2086 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:05:51 2022] sd 0:0:4:0: [sda] tag#2086 CDB: Read(10) 28 00 00 00 00 00 00 00 20 00
[Sun Sep 11 16:05:51 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 4 prio class 0
[Sun Sep 11 16:05:51 2022] sd 0:0:4:0: [sda] tag#1986 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:05:51 2022] sd 0:0:4:0: [sda] tag#1986 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:05:51 2022] sd 0:0:4:0: [sda] tag#1986 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:05:51 2022] sd 0:0:4:0: [sda] tag#1986 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:05:51 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:05:52 2022] Buffer I/O error on dev sda, logical block 0, async page read
[Sun Sep 11 16:06:59 2022] sd 0:0:4:0: [sda] tag#2054 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:06:59 2022] sd 0:0:4:0: [sda] tag#2054 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:06:59 2022] sd 0:0:4:0: [sda] tag#2054 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:06:59 2022] sd 0:0:4:0: [sda] tag#2054 CDB: Read(10) 28 00 00 00 00 00 00 00 20 00
[Sun Sep 11 16:06:59 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 4 prio class 0
[Sun Sep 11 16:07:00 2022] sd 0:0:4:0: [sda] tag#2000 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[Sun Sep 11 16:07:00 2022] sd 0:0:4:0: [sda] tag#2000 Sense Key : Illegal Request [current] 
[Sun Sep 11 16:07:00 2022] sd 0:0:4:0: [sda] tag#2000 Add. Sense: Security conflict in translated device
[Sun Sep 11 16:07:00 2022] sd 0:0:4:0: [sda] tag#2000 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[Sun Sep 11 16:07:00 2022] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[Sun Sep 11 16:07:00 2022] Buffer I/O error on dev sda, logical block 0, async page read

See all those Add. Sense: Security conflict in translated device notes in there? That seems to indicate a password-locked ATA device. I'm sure there are lots of docs about this on the interwebs, but let's just skip all that and get to a solution, shall we?

First, make sure there is nothing actually using that disk. lsblk is a decent starting place for that:

itops@warthog-1:~$ lsblk /dev/sda
NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda    8:0    0 476.9G  0 disk 
itops@warthog-1:~$ 

Nothing with /dev/sda as a parent. Maybe fuser, too?

itops@warthog-1:~$ sudo fuser -v /dev/sda
itops@warthog-1:~$ 

That looks good. More investigations, using hdparm this time:

itops@warthog-1:~$ sudo hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
	Model Number:       TOSHIBA THNSNJ512GCSU                    
	Serial Number:      65IS10ADTGTW
	Firmware Revision:  JUPS0102
	Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
	Supported: 9 8 7 6 5 
	Likely used: 9
[...]
Security: 
	Master password revision code = 65534
		supported
		enabled
		locked
	not	frozen
	not	expired: security count
		supported: enhanced erase
	Security level maximum
	2min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT.
[...]
itops@warthog-1:~$