Topic: Fix messed up USB drive


I am trying to install a debian in a machine, and created a bunch of different usb images in my usb drive. So many, now it is all messed up, and I am being unable to create a partition and format it. When I do it, this is what gparted says:

GParted 0.25.0 --enable-libparted-dmraid --enable-online-resize

Libparted 3.2
Create Primary Partition #1 (fat32, 7.72 GiB) on /dev/sda  00:00:00    ( ERROR )
create empty partition  00:00:00    ( SUCCESS )
path: /dev/sda1 (partition)
start: 4096
end: 16189383
size: 16185288 (7.72 GiB)
clear old file system signatures in /dev/sda1  00:00:00    ( SUCCESS )
write 512.00 KiB of zeros at byte offset 0  00:00:00    ( SUCCESS )
write 4.00 KiB of zeros at byte offset 67108864  00:00:00    ( SUCCESS )
write 512.00 KiB of zeros at byte offset 8286109696  00:00:00    ( SUCCESS )
write 4.00 KiB of zeros at byte offset 8286765056  00:00:00    ( SUCCESS )
write 8.00 KiB of zeros at byte offset 8286859264  00:00:00    ( SUCCESS )
flush operating system cache of /dev/sda  00:00:00    ( SUCCESS )
set partition type on /dev/sda1  00:00:00    ( SUCCESS )
new partition type: fat32
create new fat32 file system  00:00:00    ( ERROR )
mkfs.fat -F32 -v -I -n " " /dev/sda1  00:00:00    ( ERROR )
mkfs.fat 3.0.28 (2015-05-16)
/dev/sda1: No such file or directory

and although fdisk confirms the partition is there, my Linux is not detecting it (running Mint).
This is what dmesg says when I reconnect the thumb drive:

[106436.741870] usb 1-2: new high-speed USB device number 34 using xhci_hcd
[106436.889364] usb 1-2: New USB device found, idVendor=0951, idProduct=1643
[106436.889368] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[106436.889371] usb 1-2: Product: DataTraveler G3
[106436.889374] usb 1-2: Manufacturer: Kingston
[106436.889375] usb 1-2: SerialNumber: 001CC0EC34D4FC20B61623EC
[106436.890111] usb-storage 1-2:1.0: USB Mass Storage device detected
[106436.890445] scsi host2: usb-storage 1-2:1.0
[106437.931304] scsi 2:0:0:0: Direct-Access     Kingston DataTraveler G3  1.00 PQ: 0 ANSI: 4
[106437.932928] sd 2:0:0:0: Attached scsi generic sg0 type 0
[106437.932931] sd 2:0:0:0: [sda] 31246288 512-byte logical blocks: (16.0 GB/14.9 GiB)
[106437.933189] sd 2:0:0:0: [sda] Write Protect is off
[106437.933195] sd 2:0:0:0: [sda] Mode Sense: 45 00 00 00
[106437.933426] sd 2:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[106437.935514]  sda:
[106437.936627] sd 2:0:0:0: [sda] Attached SCSI removable disk

Any hint is welcome (as I formatted the windows machine, and am unable to use windows to reformat the drive).

2 (edited by gedakc 2017-08-16 17:32:49)

Re: Fix messed up USB drive

It is possible that a timing issue was encountered when using this older version of GParted (0.25.0).

If it is only a timing issue, then try you might refreshing the device list with GParted -> Refresh Devices to see if the partition shows up.  If it does then you can try to format the partition by selecting the partition and using the menu option Partition -> Format to.

If this does not work then I suggest booting from media containing the latest GParted Live which will has the most recent version of GParted, currently 0.29.0.

EDIT:  It is also possible you encountered an old bug whereby formatting an entire disk with a FAT file system might make it look like the disk had a partition table.  If this is the case, then you might try creating a new partition table (all data lost) before creating a new partition.