Unable to recognize and use a usb drive that failed on format

7 Antworten [Letzter Beitrag]
vixxo
Offline
Beigetreten: 10/26/2013

Hello, for a in ussue on user privileges on managing usb drives on ubuntu (another computer from the one I'm using with trisquel) I've failed formatting my usb drive. Now only Disks utility (gdisks) can see It and I can't do anything even from there. Attached a screen from gdisk. Here is the fdisk output:
$ sudo fdisk -l

Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders, total 250069680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a916a

Device Boot Start End Blocks Id System
/dev/sda1 2048 250068991 125033472 83 Linux

Disk /dev/mapper/sdb1_crypt: 128.0 GB, 128032178176 bytes
255 heads, 63 sectors/track, 15565 cylinders, total 250062848 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/sdb1_crypt doesn't contain a valid partition table

Disk /dev/mapper/grubcrypt-trisquel: 119.0 GB, 119030153216 bytes
255 heads, 63 sectors/track, 14471 cylinders, total 232480768 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/grubcrypt-trisquel doesn't contain a valid partition table

Disk /dev/mapper/grubcrypt-swap: 9000 MB, 9000976384 bytes
255 heads, 63 sectors/track, 1094 cylinders, total 17580032 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/grubcrypt-swap doesn't contain a valid partition table

AnhangGröße
Screenshot from 2016-04-06 20:09:32.png244.65 KB
Magic Banana

I am a member!

I am a translator!

Offline
Beigetreten: 07/24/2010

GNU ddrescue may be your last hope to recover data. Search instructions on the Web.

knacky
Offline
Beigetreten: 04/06/2016

Assuming your misbehaving usb drive shows up in lsblk as /dev/sdb (as per the screenshot), try doing the following to recover...

WARNING: DOING THIS WILL DESTROY ALL DATA ON YOUR USB DRIVE

Zeroize the entire disk:
# shred -f -v -n 0 -z /dev/sdb

Create partition type and define a partition:
# parted -a optimal /dev/sdb

then within parted...

parted> mklabel msdos
parted> mkpart primary 0% 100%
parted> quit

That will write a standard MBR to the disk and create a primary partition using all of the available space.

Format the new partition as EXT4:
# mkfs.ext4 /dev/sdb1

or...

Format the new partition as FAT32:
# mkfs.vfat /dev/sdb1

or... choose some other filesystem.

vixxo
Offline
Beigetreten: 10/26/2013

shred: /dev/sdb: failed to open for writing: No medium found

This is the output trying to shred.

About gddrescue, I'm not trying to save data on It.. I would like only to be able to format the drive.

Magic Banana

I am a member!

I am a translator!

Offline
Beigetreten: 07/24/2010

Well, forget about it. The hardware apparently is defective (by the way, can you read its SMART data, e.g., from "Disks" in the "System Settings"?). It cannot be trusted.

SuperTramp83

I am a translator!

Offline
Beigetreten: 10/31/2014

Can you try this?

sudo dd if=/dev/zero of=/dev/sdX bs=1024

wait for it to finish - it may take a looong time.

Then format it FAT32 with gparted.

EDIT: lsblk in terminal will tell you what is your usb stick, usually it is sdb, so if that is the case you will replace sdX in the above command with sdb.

onpon4
Offline
Beigetreten: 05/30/2012

All Flash media has a definite limit to the amount of writes that can be performed on it. Once that limit is reached, it will not function properly. I have an SD card which I believe is in that state, because formatting it is impossible. I wouldn't be surprised if your USB drive has reached the end of its life, too.

All storage devices fail at some point, and it's difficult or even impossible to tell when. That's why backups are important.

vixxo
Offline
Beigetreten: 10/26/2013

@Supertramp83: It could not locate the device so I can't.

@onpon4: the usb device was quite new, all the problems started when I've tried to format on ubuntu and the device was "locked" in a sort of read-only mode.