TransWikia.com

In what way did I destroy my USB and how to repair it?

Ask Ubuntu Asked by DonkeyKong on January 8, 2021

There were two attempts of mine to install something on my USB stick, both times this resulted in a, what I call, "complete destruction" of my USB stick.

Why I think that it is not a hardware problem: I tried to install a Nextcloud docker container passing the USB stick as storage location. In both cases the scenario was absolutely identical: The first installation attempt failed I retried after modifying the permissions of a folder on the USB stick with chmod, but it failed again. I retried and it was stuck in the process forever and claimed there was a process writing to the USB stick when I tried to unmount it. After a considerable amount of time I forced a restart after which the sticks were not recognised anymore.

I tried to rescue it with Gparted but unfortunately the stick is not recognised anymore. However, execution of usb-devices once with the USB stick plugged in and once without it being plugged in, reveals that the following entry is associated to one of the broken sticks, herafter referred to as stick 1 (for the other one, stick 2, there is nothing found):

T:  Bus=01 Lev=02 Prnt=02 Port=03 Cnt=03 Dev#= 11 Spd=480 MxCh= 0
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=058f ProdID=1234 Rev=00.02
S:  Manufacturer=ALCOR          
S:  Product=AU87101A UFDISK     
S:  SerialNumber=123456789ABCDEF     
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=200mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage

For stick 1 execution of
sudo lsblk -o model,name,size,fstype,label,mountpoint
yields:
USB Remove DIS sda 29.8G
For stick 2 nothing is returned.

My question: What can I do to repair the sticks (I do not care about any data on them)?

Update: I managed to overwrite stick 1 with zeros now by:
sudo dd if=/dev/zero of/dev/sda

After doing so I tried to create a new data partition on it with
sudo mkfs.ext4 /dev/sda
which gave the following output (UUID replaced by X...X):

mke2fs 1.43.4 (31-Jan-2017)
Discarding device blocks: done                            
Creating filesystem with 467512 1k blocks and 116928 inodes
Filesystem UUID: XXXXXXXXXXXXXXXXXXXXX
Superblock backups stored on blocks: 
    8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done 

Gparted then shows an entry for /dev/sda with file System unknown and a size of 456.55 MiB (compare the result of the lsblk command above). Still the stick is not recognised as USB stick properly if I plug it into an arbitrary computer (including the one I have gparted on).

2 Answers

It was a hardware problem, presumably caused by too high voltage on my RaspberryPi's USB slots. I now put a powered USB-Hub in between and the next stick did not break anymore.

Correct answer by DonkeyKong on January 8, 2021

Creating filesystems on raw disks is comprised of two steps: creating partition(s) and then creating the filesystem. I think what's happening is that you created a partition without a filesystem with gparted and then tried creating a filesystem without partitions using mkfs.ext4. Try the following:

  1. Zero out the drive again using dd just so we know we're starting from scratch
  2. Create one giant partition using gparted that takes up the entire drive
  3. Format the new partition as ext4 using the command sudo mkfs.ext4 /dev/sda1 (note the use of sda1 and not sda, this indicates the first partition vs the entire disk).

You might be already aware but Windows has no support for reading data on ext4 partitions (there are third party utilities but they're underdeveloped). If you're wanting to read this thumbdrive from Windows and are running 20.04, I would recommend formatting as exFAT. The downside to that is that exFAT doesn't support any permissions on the files/directories.

Answered by Brian Turek on January 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP