[SOLVED] Ubuntu/Debian tools to recover a frozen USB stick?

May 12, 2020
74
0
40
I dd'ed a USB thumb drive with an ISO image (in preparation for an installation), and the drive got unusable (readable, but the GPT is not writable). The most likely cause is that the drive was automounted, and I didn't notice it while dd'ing.
How can I reinitialize the drive in Ubuntu (or, as a second choice, in Debian)? When I plug in the drive and try

dd if=/dev/zero of=/dev/sdb

I get the following output in dmesg:

Code:
[   60.097654] usb 3-3: new high-speed USB device number 4 using xhci_hcd
[   60.253359] usb 3-3: New USB device found, idVendor=058f, idProduct=6387, bcdDevice= 1.02
[   60.253364] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   60.253367] usb 3-3: Product: Mass Storage
[   60.253369] usb 3-3: Manufacturer: Generic
[   60.253371] usb 3-3: SerialNumber: 3FE94C58
[   60.276349] usb-storage 3-3:1.0: USB Mass Storage device detected
[   60.276440] scsi host5: usb-storage 3-3:1.0
[   60.276528] usbcore: registered new interface driver usb-storage
[   60.280951] usbcore: registered new interface driver uas
[   61.281075] scsi 5:0:0:0: Direct-Access     Generic  Flash Disk       8.07 PQ: 0 ANSI: 4
[   61.281884] sd 5:0:0:0: Attached scsi generic sg2 type 0
[   61.282640] sd 5:0:0:0: [sdb] 4014080 512-byte logical blocks: (2.06 GB/1.91 GiB)
[   61.283348] sd 5:0:0:0: [sdb] Write Protect is off
[   61.283355] sd 5:0:0:0: [sdb] Mode Sense: 23 00 00 00
[   61.284064] sd 5:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[   61.312518]  sdb: sdb1 sdb2
[   61.314679] sd 5:0:0:0: [sdb] Attached SCSI removable disk
[  193.604355]  sdb: sdb1 sdb2
[  193.835425] sd 5:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[  193.835428] sd 5:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current]
[  193.835430] sd 5:0:0:0: [sdb] tag#0 <<vendor>>ASC=0xff <<vendor>>ASCQ=0xff
[  193.835432] sd 5:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 00 00 00 00 00 28 00
[  193.835434] blk_update_request: I/O error, dev sdb, sector 0 op 0x1:(WRITE) flags 0x0 phys_seg 5 prio class 0
[  193.836207] Buffer I/O error on dev sdb, logical block 0, lost async page write
[  193.836913] Buffer I/O error on dev sdb, logical block 1, lost async page write
[  193.837525] Buffer I/O error on dev sdb, logical block 2, lost async page write
[  193.838117] Buffer I/O error on dev sdb, logical block 3, lost async page write
[  193.838702] Buffer I/O error on dev sdb, logical block 4, lost async page write
[  193.848109] sd 5:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s

I already tried hdparm -r0 /dev/sdb and sg_format --format /dev/sdb and the tool mkusb/dus. Here is some more data:

# hdparm /dev/sdb

/dev/sdb:
SG_IO: bad/missing sense data, sb[]: f0 00 05 00 00 00 00 0a 00 00 00 00 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
multcount = 0 (off)
readonly = 0 (off)
readahead = 256 (on)
geometry = 1011/64/62, sectors = 4014080, start = 0
# sg_modes /dev/sdb
Generic Flash Disk 8.07 peripheral_type: disk [0x0]
Mode parameter header from MODE SENSE(10):
Mode data length=8, medium type=0x00, WP=0, DpoFua=0, longlba=0
Block descriptor length=0
 
Last edited:
Solution
2: You can get Gparted as a standalone live-iso -link- or get almost any of the well known distros live images and you will fing Gparted in program menu. Two of my recent installed distros that I know Gparted is available in live modus is Fedora Linux and MX Linux.

3: That was just me forgetting about the excact wording - I meant to say "Create Partition Table".
May 12, 2020
74
0
40
Gparted is a powerful tool. Try do delete all partions
The menu entry “delete” is gray and cannot be chosen:
kTUyJe7.png
 
May 12, 2020
74
0
40
Try this:
  • Make sure Gparted is running with root privileges.
  • Gparted live-iso (opposed to Gparted from an already installed distro)
  • In Gparted - try to make new partition table (select dos type).
  1. Gparted is started as "sudo gparted /dev/sdf".
  2. Why from a live iso? I can grab any version from the Debian repositories if you tell me which version is required. (A live Debian ISO would be messy to get to work for me, since neither gparted nor the network drivers required on my computer are installed by default on it.) I also tried formatting on a Mac Air (without success) when it was available.
  3. The new partition menu entry is grayed and not clickable:
cSaKfsD.png

make sure nothing automounted the device.
Right. I ran "sudo umount /dev/sdf", "sudo umount /dev/sdf1", "sudo umount /dev/sdf2" (and that were all the devices that appeared when the USB drive was inserted) before starting gparted; the result is the same.
 
Last edited:
2. Because if something keeps the device locked. Maybe it's just a stupid advice, but I'd try it out anyway. Any distro that include Gparted in the live-iso should be ok.
There are probably better methods for ensuring that devices are not in use.

3 - in the Device menu (I dont't hage gparted installed on this current computer so I may get the menu item name not quite correct).
 
May 12, 2020
74
0
40
2. Any distro that include Gparted in the live-iso should be ok.

3 - in the Device menu (I dont't hage gparted installed on this current computer so I may get the menu item name not quite correct).
Thank you for an answer.
2: Is there any such live iso? If you have one in mind that works with my ASPEED AST2500 64MB graphics card outputting to a VGA header port (so that we have graphical output at all) AND has GParted installed, I'd be happy to know it. (Clearly, we wish to avoid potentially demolishing yet another USB drive while attempting to install a live ISO, which is what actually killed the drive we are trying to revive.)
3: The menu “Device” does not allow creating a new partition, but a new partition table:
vXqAoxU.png

Choosing “Creating Partition Table...” and then choosing the “msdos” type leads to a report of an input/output error.
 
Last edited:
2: You can get Gparted as a standalone live-iso -link- or get almost any of the well known distros live images and you will fing Gparted in program menu. Two of my recent installed distros that I know Gparted is available in live modus is Fedora Linux and MX Linux.

3: That was just me forgetting about the excact wording - I meant to say "Create Partition Table".
 
Solution
May 12, 2020
74
0
40
2: You can get Gparted as a standalone live-iso -link- or get almost any of the well known distros live images and you will fing Gparted in program menu. Two of my recent installed distros that I know Gparted is available in live modus is Fedora Linux and MX Linux.
Thanks. Not sure I'll do it (since I could hypothetically destroy yet another USB stick in the cause of the action), but thank you anyway!