LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-02-2021, 03:38 PM   #1
aiszisz
LQ Newbie
 
Registered: Dec 2020
Distribution: Slackware64 14.2
Posts: 28

Rep: Reputation: 11
Restore crashed USB flash drive


Hi folks!

It's funny and awkward at the same time, while I tried to solve an issue with a windows iso I caused another one ))

I followed a howto and gave this command as root:

ms-sys -7 /dev/sdb1

It should have write mbr to the usb device, and according the output the process was successful but the result was strange.
It created 4 partitions two of them was about 100GB one was some TB but the whole USB device is 30GB. I thought it's not OK so I erased the partition table created a new one and run mkfs:

mkfs.ntfs /dev/sdb1

It started to format the partition (so creating the new table should be ok).
Then I realized I forgot the -f option for fast formatting and I did something stupid. I aborted the process! Now my flash drive is broken.

After I plug the USB device:
Code:
[dev]# dmesg|tail    
[ 9963.269811] usb 1-2: Device not responding to setup address.
[ 9963.470784] usb 1-2: Device not responding to setup address.
[ 9963.671737] usb 1-2: device not accepting address 24, error -71
[ 9979.966929] usb 1-2: new high-speed USB device number 26 using xhci_hcd
[ 9980.131252] usb 1-2: New USB device found, idVendor=ffff, idProduct=1201
[ 9980.131261] usb 1-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 9980.131804] usb-storage 1-2:1.0: USB Mass Storage device detected
[ 9980.132501] scsi host32: usb-storage 1-2:1.0
[ 9981.133472] scsi 32:0:0:0: Direct-Access     NAND     USB2DISK         0.00 PQ: 0 ANSI: 4
[ 9981.135336] sd 32:0:0:0: [sdb] Attached SCSI removable disk
Code:
[dev]# lsusb
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 006: ID 1bcf:2895 Sunplus Innovation Technology Inc. 
Bus 003 Device 005: ID 413c:8197 Dell Computer Corp. 
Bus 003 Device 007: ID 0b97:7772 O2 Micro, Inc. OZ776 CCID Smartcard Reader
Bus 003 Device 004: ID 0b97:7761 O2 Micro, Inc. Oz776 1.1 Hub
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 026: ID ffff:1201 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
(my device is the bold line)

But neither lsblk nor fdisk can't see my drive

Code:
[dev]# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 298.1G  0 disk 
|-sda1   8:1    0     1K  0 part 
|-sda2   8:2    0  46.6G  0 part 
|-sda5   8:5    0   3.7G  0 part [SWAP]
|-sda6   8:6    0  46.6G  0 part /
`-sda7   8:7    0 201.2G  0 part /run/media/a/5bca266b-1574-463c-ba56-6d9ed4bc9c0e
sr0     11:0    1  1024M  0 rom
Code:
[dev]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

fdisk: cannot open /dev/sdb: No medium found
Is there any way to restore my flash drive? I found no threads with solution in any forum. The device is not a fake device it used to work before. I tried on all my USB port and even another linux machine with the same result. Ports are OK the drive is broken for sure. There is no (important) data on the device I just want it to work again.
Thanks a lot!
 
Old 01-02-2021, 04:47 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,415
Blog Entries: 7

Rep: Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955
If you are double sure that /dev/sdb is the usb device.
Code:
dd if=/dev/zero of=/dev/sdb bs=1M count=10
Does that cause the device to show up with fdisk -l? If so use fdisk to put at least 1 partition on it, format that partition/s.
 
1 members found this post helpful.
Old 01-02-2021, 04:50 PM   #3
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
You can try wiping the corrupted partition table area with
Code:
dd if=/dev/zero of=/dev/sdb bs=1M count=1
then use fdisk or parted to recreate the partition table.

Make certain the output of dd above is pointing to the correct device before you execute it.

If dd can't write to it that way then the device is likely no longer usable. If still good this should allow you to recover it.
 
1 members found this post helpful.
Old 01-02-2021, 05:59 PM   #4
aiszisz
LQ Newbie
 
Registered: Dec 2020
Distribution: Slackware64 14.2
Posts: 28

Original Poster
Rep: Reputation: 11
Code:
[downloads]# dd if=/dev/zero of=/dev/sdb bs=1M count=10
dd: failed to open '/dev/sdb': No medium found
Unfortunately dd gives the same error as fdisk...
 
Old 01-02-2021, 07:40 PM   #5
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
Just a thought. Have you rebooted since you torched the USB? If not then with the device unplugged please reboot and log back in. Then plug in the USB device again and give us the tail of dmesg again so we can see if the system even sees it. lsusb should see it as well but lsblk possibly not.

Don't do anything else with it initially but if dmesg shows a device name such as sdb like you posted before, then try the dd command again as you just did. Make certain the "of=/dev/sdX" part of the dd command shows the device you just identified. It may work in which case you are in luck. If not then the device is history and can be thrown.
 
Old 01-03-2021, 11:00 AM   #6
aiszisz
LQ Newbie
 
Registered: Dec 2020
Distribution: Slackware64 14.2
Posts: 28

Original Poster
Rep: Reputation: 11
Nothing changed...
Code:
[a]# dmesg|tail
[   88.864953] Bluetooth: RFCOMM ver 1.11
[  813.488012] usb 3-1.2: new high-speed USB device number 7 using ehci-pci
[  813.573642] usb 3-1.2: New USB device found, idVendor=ffff, idProduct=1201
[  813.573650] usb 3-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[  813.662077] usb-storage 3-1.2:1.0: USB Mass Storage device detected
[  813.662248] scsi host8: usb-storage 3-1.2:1.0
[  813.662468] usbcore: registered new interface driver usb-storage
[  813.669093] usbcore: registered new interface driver uas
[  814.665231] scsi 8:0:0:0: Direct-Access     NAND     USB2DISK         0.00 PQ: 0 ANSI: 4
[  814.668402] sd 8:0:0:0: [sdb] Attached SCSI removable disk
[a]# lsusb
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 005: ID 1bcf:2895 Sunplus Innovation Technology Inc. 
Bus 003 Device 004: ID 413c:8197 Dell Computer Corp. 
Bus 003 Device 006: ID 0b97:7772 O2 Micro, Inc. OZ776 CCID Smartcard Reader
Bus 003 Device 003: ID 0b97:7761 O2 Micro, Inc. Oz776 1.1 Hub
Bus 003 Device 007: ID ffff:1201  
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[a]# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 298.1G  0 disk 
|-sda1   8:1    0     1K  0 part 
|-sda2   8:2    0  46.6G  0 part 
|-sda5   8:5    0   3.7G  0 part [SWAP]
|-sda6   8:6    0  46.6G  0 part /
`-sda7   8:7    0 201.2G  0 part 
sr0     11:0    1  1024M  0 rom  
[a]# dd if=/dev/zero of=/dev/sdb bs=1M count=10
dd: failed to open '/dev/sdb': No medium found
[a]#
 
Old 01-03-2021, 12:27 PM   #7
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,415
Blog Entries: 7

Rep: Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955
/dev/sdb, that is it.
Code:
[  814.665231] scsi 8:0:0:0: Direct-Access     NAND     USB2DISK         0.00 PQ: 0 ANSI: 4
[  814.668402] sd 8:0:0:0: [sdb] Attached SCSI removable disk
https://linux.die.net/man/1/ms-sys
What happens when you stick it into a windows machine?
 
Old 01-03-2021, 12:36 PM   #8
aiszisz
LQ Newbie
 
Registered: Dec 2020
Distribution: Slackware64 14.2
Posts: 28

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by teckk View Post
https://linux.die.net/man/1/ms-sys
What happens when you stick it into a windows machine?
That's a good question! I am wondering too and I would have tried it already if I would have a windows machine. First time I get close to one is Friday. I will check if I can reformat it or fix with diskpart!
 
Old 01-03-2021, 01:57 PM   #9
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,843

Rep: Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682
Did you try
Code:
parted /dev/sdb
 
Old 01-03-2021, 02:25 PM   #10
aiszisz
LQ Newbie
 
Registered: Dec 2020
Distribution: Slackware64 14.2
Posts: 28

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by colorpurple21859 View Post
Did you try
Code:
parted /dev/sdb
yeah

Code:
[a]# dmesg|tail
[ 6549.930411] ERROR @wl_notify_scan_status : eth1 Scan_results error (-22)
[10694.419837] usb 3-2: new high-speed USB device number 2 using xhci_hcd
[10694.584138] usb 3-2: New USB device found, idVendor=ffff, idProduct=1201
[10694.584144] usb 3-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[10694.606567] usb-storage 3-2:1.0: USB Mass Storage device detected
[10694.606673] scsi host8: usb-storage 3-2:1.0
[10694.606830] usbcore: registered new interface driver usb-storage
[10694.613839] usbcore: registered new interface driver uas
[10695.609384] scsi 8:0:0:0: Direct-Access     NAND     USB2DISK         0.00 PQ: 0 ANSI: 4
[10695.610417] sd 8:0:0:0: [sdb] Attached SCSI removable disk
[a]# parted /dev/sdb
Error: Error opening /dev/sdb: No medium found
Retry/Cancel? r                                                           
Error: Error opening /dev/sdb: No medium found
Retry/Cancel? c                                                           
[a]#
 
Old 04-02-2022, 05:20 PM   #11
shevegen
Member
 
Registered: May 2004
Distribution: Slackware / GoboLinux / LFS / VoidLinux
Posts: 145

Rep: Reputation: 26
I have a similar problem.

It happens with an INTENSO USB Disc that is fairly large, 32GB.

When I plug it in I get this output:

[3833577.842542] usb 1-5: USB disconnect, device number 7
[3834877.780984] usb 1-5: new high-speed USB device number 8 using ehci-pci
[3834877.911339] usb 1-5: New USB device found, idVendor=ffff, idProduct=1201, bcdDevice= 0.00
[3834877.911353] usb 1-5: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[3834877.912548] usb-storage 1-5:1.0: USB Mass Storage device detected
[3834877.912920] scsi host7: usb-storage 1-5:1.0
[3834878.923763] scsi 7:0:0:0: Direct-Access NAND USB2DISK 0.00 PQ: 0 ANSI: 4
[3834878.925481] sd 7:0:0:0: [sdd] Media removed, stopped polling
[3834878.927219] sd 7:0:0:0: [sdd] Attached SCSI removable disk

Using "fdisk -l", unfortunately, I do not see anything else. It does not seem to be fully recognized.

I have other small USB sticks with 32GB which seem to work fine, although USB transfer is very slow
to these. These USB sticks do not work on windows either; I just tested it and it is saying "Installing
USB Mass Driver" or something like that, but afterwards it is not recognized.

I think something is missing but I have not figured out why or how. I am reporting this in the event
others come with a similar issue. This was a fresh purchase; never used that USB stick particularly.
Normally USB sticks purchased all work fine for me on Linux.
 
Old 04-03-2022, 12:45 AM   #12
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
The last 2 lines of your dmesg output look interesting, somewhat contradictory. Faulty contact?

Anyhow, plaease use this method to provide the dmesg output.
 
Old 04-07-2022, 08:10 AM   #13
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 22 MATE, Peppermint OS-Devuan, EndeavourOS, antiX
Posts: 4,359
Blog Entries: 49

Rep: Reputation: 1598Reputation: 1598Reputation: 1598Reputation: 1598Reputation: 1598Reputation: 1598Reputation: 1598Reputation: 1598Reputation: 1598Reputation: 1598Reputation: 1598
aiszisz,


It sounds like your USB drive may be faulty.

Try installing dcfldd, zero the drive and then verify that it has been zeroed.

Then compare the two files with the comparison command (cmp).

dcfldd:
http://dcfldd.sourceforge.net/

Code:
sudo apt install dcfldd
Insert the USB drive and zero it:
This can take quite a while, depending on the size of the drive. Be patient!

Code:
sudo su

# dcfldd if=/dev/zero of=/dev/sdc bs=1M
Then remove and reinsert the USB drive.

Code:
# cmp /dev/zero /dev/sdc

My first output for a 8GB drive was:

7680 blocks (7680Mb) written.dcfldd:: No space left on device.

The cmp will hopefully fail at the point where it has reached the end of the drive.

If it fails before then, the drive isn't usable any more.

My second output was:

Code:
/dev/zero /dev/sdc differ: byte 1011713, line 1
which indicated a faulty drive.
 
Old 04-07-2022, 08:52 AM   #14
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,317

Rep: Reputation: 1331Reputation: 1331Reputation: 1331Reputation: 1331Reputation: 1331Reputation: 1331Reputation: 1331Reputation: 1331Reputation: 1331Reputation: 1331
My guess is this is one of many fake USB drives. It claimed to be 30G but is not in reality. It hasn't shown any sign of working since the initial write I don't think you did anything wrong. Return it for refund or throw it out.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Over-write Windows Restore USB flash drive... buccaneere Linux - Hardware 12 05-15-2016 05:43 AM
Cloning bootable USB flash drive onto larger flash drive - best method? cilbuper Linux - General 5 02-26-2014 09:51 AM
How to Create an Image of Linux Redhat 5 and Restore it while crashed? yousefzad Linux - Newbie 1 10-30-2012 09:58 AM
Is there ANY way for a proper shut down if USB has crashed with a mounted USB drive? TTL_2 Linux - Hardware 2 09-24-2008 08:04 AM
FLASH FLASH XP Home and Samba Fix FLASH FLASH zollodav Linux - Networking 1 02-19-2006 01:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 11:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration