Problem with USB flash drive (first copying files, today write protected) I can't format my drive! Please help!

Asked by Piotr on 2021-04-25

Dear Community,

Can you help me? I have problem with my USB flash drive. I asked you some times ago and I tell you that I had problem with copying files. All files was broken after copy (cp command) on USB Flash drive. This was not problem in Windows 10 where I could copy files without error (only one file on Windows was broken after copy). Today I connected this USB Flash drive to my computer with Lubuntu. And I copied some files. I noticed bug on graphic environment because I couldn't do anything so I must logout. Next I log in again and my USB Flash drive work fine but after umount and plug out device and when I wanted to plug in again I have big problem because my USB Flash I think is dead now. I lost all partitions. I don't know if it is problem with Lubuntu system (bug), filesystem on USB Flash drive, firmware problem on USB drive or hardware problem. Now I can't format this USB flash drive. I tried used GNOME disk, fdisk, gdisk, hadparm, shred and everything tell me that this device (/dev/sdb) is on read only mode. How I can fix it or check if it is problem with hardware (USB flash drive) or problem with filesystem?

Can you help me?

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Piotr (peterq94) said : #2

I tried also format on Windows 10 with diskpart. It is also error and can't do this. So we have two option. USB Flash drive is dead or problem with firmware caused by bug in Lubuntu system.

Can I restore filesystem (partitions) on Lubuntu with default software?

Manfred Hampl (m-hampl) said : #3

What kind of device is this? a USB stick, or a USB-connected hard drive, or ...? Does it have a make and model?
What messages do you receive in dmesg when you plug that device into the Ubuntu system?

Piotr (peterq94) said : #5

Mr Manfred Hampl, this is usb flash drive. Similar to this but 8 GB size and uknown brand and model -->

On GNOME disk I can see: "Flash USB Disk (2.F0)"

On dmesg I can't see any helpful information. How I can find what information is added to dmesg during pluggin device to the computer? It is very hard to find what information is added to the kernel by this device. On this moment I only found:

"usb 2-1: New USB device found, idVendor=8228, idProduct=5236, bcdDevice= 0.00
[ 97.810966] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 97.810968] usb 2-1: SerialNumber: 3727254F8050CA2565505"

Piotr (peterq94) said : #6

fdisk doesn't work for this device. I can only listing:

"disk /dev/sdb: 7.5 GiB, bytes: 8053063680, sectors: 15,728,640
Units: sectors, i.e. 1 * 512 = 512 bytes
Sector size (logical / physical) in bytes: 512/512
I / O size (minimum / optimal) in bytes: 512/512 "

Manfred Hampl (m-hampl) said : #7

1. "How I can find what information is added to dmesg during pluggin device to the computer?"

I have already given instructions how to do this in comment #8

issue the command
dmesg | tail
and remember the time code (the numbers in brackets) of the last entry.

Then plug the USB data stick into the computer, wait ten seconds and re-issue the command
dmesg | tail

You will see some new messages (with a time code higher than the highest one from before).

2. "fdisk doesn't work for this device"

This is not true. fdisk has produced output, so it definitely does work.

Piotr (peterq94) said : #8

Mr Manfred Hampl, yes you have right that you gave me instruction in the past. Now I remember it.

This is my dmesg | tail for this device:

"[ 3226.472242] usb-storage 2-1:1.0: USB Mass Storage device detected
[ 3226.476418] scsi host5: usb-storage 2-1:1.0
[ 3227.510450] scsi 5:0:0:0: Direct-Access Flash USB Disk 2.F0 PQ: 0 ANSI: 2
[ 3227.511274] sd 5:0:0:0: Attached scsi generic sg2 type 0
[ 3227.513551] sd 5:0:0:0: [sdb] 15728640 512-byte logical blocks: (8.05 GB/7.50 GiB)
[ 3227.514499] sd 5:0:0:0: [sdb] Write Protect is on
[ 3227.514506] sd 5:0:0:0: [sdb] Mode Sense: 0b 00 80 08
[ 3227.515112] sd 5:0:0:0: [sdb] No Caching mode page found
[ 3227.515123] sd 5:0:0:0: [sdb] Assuming drive cache: write through
[ 3227.550098] sd 5:0:0:0: [sdb] Attached SCSI removable disk"

I have problem with Write Protect is on. I can't format this drive. You can see this information on dmesg.

fdisk work but only in read only mode. I can't create partition on fdisk.

Piotr (peterq94) said : #9

sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.31.1).
The changes will only remain in memory until you save them.
Please be careful before using the write command.

fdisk: cannot open / dev / sdb: Read-only filesystem

This is output of fdisk. Can you help? I also tried sudo hdparm -r0 /dev/sdb but this also doesn't help.

Manfred Hampl (m-hampl) said : #10

I assume that the USB stick is defective. You can try using it on a different computer and/or a different operating system. Eventually it works there, but I doubt this.

Piotr (peterq94) said : #11

I tried on Windows 10 on another machine and this also doesn't work. I can't format this drive in diskpart. This pendrive was dead while I used in on Lubuntu. Like I said I had bug with GUI. In next time I will be do everything in terminal because it is more safe I think. Of course this could be accident but I think that this bug from Lubuntu could killed my USB stick.

Manfred Hampl (m-hampl) said : #12

"I think that this bug from Lubuntu could killed my USB stick."

Which Ubuntu bug are you talking of?

Don't confuse a program bug and a program crash

Piotr (peterq94) said : #13

This was not crash of the program because this still working. I only noticed that window with auto mount option was flicker (this looked like this program will stop working and next they start working again) and I could not umount device or close window. I musted umount by terminal.

Piotr (peterq94) said : #14

This is not possible to restore to life this USB memory without 3rd party programs so this end this subject. Thank you Manfred for help.