Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Need a USB Flash Drive Wizard

Need help with peripherals or devices?
Message
Author
dcihon
Posts: 279
Joined: 2012-09-23 16:18
Been thanked: 3 times

Need a USB Flash Drive Wizard

#1 Post by dcihon »

No matter what I have tried with dd gparted and whatever command I could find reference to on the internet I cannot get my flash drive to stop being read only.
Looks like I might have to trash the drive.

I will try anything at this point even clicking my heels together and say there's no place like home if that will help.
Looking for commands to try?

Lets start with some info:

Code: Select all

root@cihonm:~ # fdisk /dev/sdb

Welcome to fdisk (util-linux 2.31.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: Read-only file system

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Need a USB Flash Drive Wizard

#2 Post by Head_on_a_Stick »

Code: Select all

# hdparm -R0 /dev/sdb
deadbang

dcihon
Posts: 279
Joined: 2012-09-23 16:18
Been thanked: 3 times

Re: Need a USB Flash Drive Wizard

#3 Post by dcihon »

1|root@cihonm:~ # hdparm -R0 /dev/sdb

/dev/sdb:
setting write-read-verify to 0
SG_IO: bad/missing sense data, sb[]: f0 00 05 00 00 00 00 0a 00 00 00 00 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: bad/missing sense data, sb[]: f0 00 05 00 00 00 00 0a 00 00 00 00 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
write-read-verify = not supported
2|root@cihonm:~ # hdparm -I /dev/sdb

/dev/sdb:
SG_IO: bad/missing sense data, sb[]: f0 00 05 00 00 00 00 0a 00 00 00 00 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

ATA device, with non-removable media
Standards:
Likely used: 1
Configuration:
Logical max current
cylinders 0 0
heads 0 0
sectors/track 0 0
--
Logical/Physical Sector size: 512 bytes
device size with M = 1024*1024: 0 MBytes
device size with M = 1000*1000: 0 MBytes
cache/buffer size = unknown
Capabilities:
IORDY not likely
Cannot perform double-word IO
R/W multiple sector transfer: not supported
DMA: not supported
PIO: pio0


dcihon
Posts: 279
Joined: 2012-09-23 16:18
Been thanked: 3 times

Re: Need a USB Flash Drive Wizard

#5 Post by dcihon »

Sorry I am not going to use a ppa.

Here is more info:

Code: Select all

root@cihonm:~ # lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 009: ID 058f:6387 Alcor Micro Corp. Flash Drive
B

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: Need a USB Flash Drive Wizard

#6 Post by Segfault »

Mentioned mkusb seems to be merely a frontend for traditional command line tools.

dcihon
Posts: 279
Joined: 2012-09-23 16:18
Been thanked: 3 times

Re: Need a USB Flash Drive Wizard

#7 Post by dcihon »

I installed it from Launchpad and it doesn't help either.

Edit:
Latest info:

Code: Select all

root@cihonm:~ # hdparm -r0 /dev/sdb                                                                                                                                  

/dev/sdb:
 setting readonly to 0 (off)
 readonly      =  0 (off)
Then:

Code: Select all

root@cihonm:~ # dd if=/dev/zero of=/dev/sdb
dd: failed to open '/dev/sdb': Read-only file system
1|root@cihonm:~ # dd if=/dev/sdb of=/dev/sdb                                                                                                                         
dd: failed to open '/dev/sdb': Read-only file system

Code: Select all

1|root@cihonm:~ # dmesg | tail
[11691.687094] usb 1-8.5: SerialNumber: 605933F7
[11691.689120] usb-storage 1-8.5:1.0: USB Mass Storage device detected
[11691.689304] scsi host4: usb-storage 1-8.5:1.0
[11692.713191] scsi 4:0:0:0: Direct-Access     Generic  Flash Disk       8.07 PQ: 0 ANSI: 4
[11692.714037] sd 4:0:0:0: Attached scsi generic sg2 type 0
[11692.714557] sd 4:0:0:0: [sdb] 122880000 512-byte logical blocks: (62.9 GB/58.6 GiB)
[11692.715254] sd 4:0:0:0: [sdb] Write Protect is off
[11692.715260] sd 4:0:0:0: [sdb] Mode Sense: 23 00 00 00
[11692.715953] sd 4:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[11692.723968] sd 4:0:0:0: [sdb] Attached SCSI removable disk

Code: Select all

root@cihonm:~ # fdisk /dev/sdb                                                                                                                                       

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

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x9c16c680.

Command (m for help): 

Code: Select all

Command (m for help): d
No partition is defined yet!
Could not delete partition 94356203391129

Command (m for help): 1
1: unknown command

Command (m for help): d
No partition is defined yet!
Could not delete partition 94356203391129

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-122879999, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-122879999, default 122879999): 

Created a new partition 1 of type 'Linux' and of size 58.6 GiB.

Command (m for help): w
fdisk: failed to write disklabel: Operation not permitted
I am right now trying some things with testdisk.
I will post here how it goes.

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

Re: Need a USB Flash Drive Wizard

#8 Post by llivv »

what's the make?

have you looked on the manufactures site?

where you ever able to write to the drive?
In memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: Need a USB Flash Drive Wizard

#9 Post by Segfault »

IMHO there are two possibilities, either the write protect switch is on (some USB drives have this switch) or the drive is dead. I have several flash storage devices gone bad like this.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Need a USB Flash Drive Wizard

#10 Post by Head_on_a_Stick »

Segfault wrote:the drive is dead
^ This.
deadbang

dcihon
Posts: 279
Joined: 2012-09-23 16:18
Been thanked: 3 times

Re: Need a USB Flash Drive Wizard

#11 Post by dcihon »

There is no switch on this drive.

I started to use photorec and it was restoring files from the drive and then my / partition filled up so I had to fix that.

I will post back here my progress but I think the drive might have gone bad.
It did work up until Saturday. I was using a package called Meld and when I went to use the drive it stopped working. Not sure it that is a coincidence or not.
Thanks everyone for trying to help.
I have ordered a new drive.

dcihon
Posts: 279
Joined: 2012-09-23 16:18
Been thanked: 3 times

Re: Need a USB Flash Drive Wizard

#12 Post by dcihon »

So I thought I would post on update.
I have never used photrec before.
It was able to retrieve about 7,100 of the files on the flash drive. I had over 9,000 files on that drive.
So I don't know what happened to the drive and why I can't get it to work but most if not all the files are there.
photorec doesn't recover the file name but the content of the file is in tact with the correct file extension.

Not sure what I am going to do next.

dcihon
Posts: 279
Joined: 2012-09-23 16:18
Been thanked: 3 times

Re: Need a USB Flash Drive Wizard

#13 Post by dcihon »

Ok I bought a new drive.
Formated it with gparted.
Put some files on it.
I haven't done anything else.
I don't understand why I am getting these results from these commands:

Code: Select all

root@cihonm:~ # fsck /dev/sdb1 
fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
fsck.ext2: No such file or directory while trying to open /dev/sdb1
Possibly non-existent device?
8|root@cihonm:~ # fsck /dev/sdb1                                                                                                                                              
fsck from util-linux 2.31.1
fsck.fat 4.1 (2017-01-24)
0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
? 2
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
  65:01/00
1) Copy original to backup
2) Copy backup to original
3) No action
? 3
/dev/sdb1: 21 files, 1112/2047467 clusters

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Need a USB Flash Drive Wizard

#14 Post by bw123 »

dcihon wrote:...I don't understand why I am getting these results from these commands:<snip>
I'm on stretch (util-linux 2.29.2-1) and still use FAT32 occasionally on usb or sdcard. The error about dirty bit is pretty common.

From what I can tell, it's caused by what it says, "Fs was not properly unmounted" and I have found that some devices, specifically microsd usb adapter has some issues when any block command like fdisk, fsck, or blkid is used on it. The device is fine with mount/read/write for hours or days, but the second I use any block command on it, the kernel burps and spams dmesg with "Driver Sense errors" and such until I remove the device, and reinsert.

So I have gotten in the habit of
# watch 'dmesg | tail'
when using the problematic device...
resigned by AI ChatGPT

dcihon
Posts: 279
Joined: 2012-09-23 16:18
Been thanked: 3 times

Re: Need a USB Flash Drive Wizard

#15 Post by dcihon »

This is what it shows when I plug it in:

Code: Select all

root@cihonm:~ # dmesg | tail
[66757.664309] scsi host4: usb-storage 1-8.5:1.0
[66758.667401] scsi 4:0:0:0: Direct-Access     General  UDisk            5.00 PQ: 0 ANSI: 2
[66758.668087] sd 4:0:0:0: Attached scsi generic sg2 type 0
[66758.668330] sd 4:0:0:0: [sdb] 131072000 512-byte logical blocks: (67.1 GB/62.5 GiB)
[66758.668522] sd 4:0:0:0: [sdb] Write Protect is off
[66758.668527] sd 4:0:0:0: [sdb] Mode Sense: 0b 00 00 08
[66758.668729] sd 4:0:0:0: [sdb] No Caching mode page found
[66758.668738] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[66758.670214]  sdb: sdb1
[66758.671307] sd 4:0:0:0: [sdb] Attached SCSI removable disk
The light on the USB drive is solid.
When I eject it the Device description changes from 67 GB Volume to General UDisk: 67 GB Volume and the light is flashing very rapidly. So it doesn't get fully ejected.
The only way I have found to fully eject it is after ejecting it from the file manager then open Disks and power it off. If I just take it out when it is flashing then it write protects it and I can't add or delete anything on it.
Should I buy a more expensive flash drive?
What I am going to use this flash drive for is listening to my mp3 files in my car.

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: Need a USB Flash Drive Wizard

#16 Post by Segfault »

It is flashing because it is writing cached data. Wait until it finishes before pulling it.
Last edited by Segfault on 2018-04-04 12:38, edited 1 time in total.

dcihon
Posts: 279
Joined: 2012-09-23 16:18
Been thanked: 3 times

Re: Need a USB Flash Drive Wizard

#17 Post by dcihon »

So I don't understand then.
If I put the flash drive into the computer and it mounts. I immediately eject without writing anything to it.
The drive is flashing rapidly and it stays that way. How long should I have to wait?
I don't seem to have to do that with other flash drives.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Need a USB Flash Drive Wizard

#18 Post by bw123 »

dcihon wrote:This is what it shows when I plug it in:

Code: Select all

root@cihonm:~ # dmesg | tail
[66757.664309] scsi host4: usb-storage 1-8.5:1.0
[66758.667401] scsi 4:0:0:0: Direct-Access     General  UDisk            5.00 PQ: 0 ANSI: 2
[66758.668087] sd 4:0:0:0: Attached scsi generic sg2 type 0
[66758.668330] sd 4:0:0:0: [sdb] 131072000 512-byte logical blocks: (67.1 GB/62.5 GiB)
[66758.668522] sd 4:0:0:0: [sdb] Write Protect is off
[66758.668527] sd 4:0:0:0: [sdb] Mode Sense: 0b 00 00 08
[66758.668729] sd 4:0:0:0: [sdb] No Caching mode page found
[66758.668738] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[66758.670214]  sdb: sdb1
[66758.671307] sd 4:0:0:0: [sdb] Attached SCSI removable disk
The light on the USB drive is solid.
When I eject it the Device description changes from 67 GB Volume to General UDisk: 67 GB Volume and the light is flashing very rapidly. So it doesn't get fully ejected.
The only way I have found to fully eject it is after ejecting it from the file manager then open Disks and power it off. If I just take it out when it is flashing then it write protects it and I can't add or delete anything on it.
Should I buy a more expensive flash drive?
What I am going to use this flash drive for is listening to my mp3 files in my car.
I've never seen one act like that, and the "assuming write through" stuff kind of reminds me of using a floppy?. Maybe you can get more info by looking at dmesg during the whole insert/mount/eject thing...

I have good luck with the cheap usb flash drives. I won't mention any brands but you know them I'm sure. The general way the led seems to work usually is:
Plug it in,
led starts to blink fairly steady about 7 times.
led then begins to fade in and out slowly (idle)
led blinks rapidly when mounted, then idle.
led blinks rapidly when reading/writing, then idle.
led blinks rapidly when umount, then idle.

Are you sure you haven't setup some doodad to sync or open the thing automatically? You really don't want to unplug it when something is accessing it. You can use something like fuser to find out if anything has it open.

I use dosfsck with the second verification pass to fix mine when it gets dirty bit:
$ man dosfsck
# dosfsck -avV

On occasion FAT32 can get so twisted up that only an old ver of chkdsk from dos or early windows can straighten it out. It's pretty reliable on linux though.
resigned by AI ChatGPT

dcihon
Posts: 279
Joined: 2012-09-23 16:18
Been thanked: 3 times

Re: Need a USB Flash Drive Wizard

#19 Post by dcihon »

Yea I threw the first one away and bought a new one.
This whole thing with ejecting is on a new flash drive.
I will try some of the suggestions and post back.
Should I start a different thread?

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Need a USB Flash Drive Wizard

#20 Post by pylkko »

we have seen this same problem on this forum, and also on other forums around the internet. unfortunately flash media (referring here to sd-cards and usb sticks specifically) are complex. they are essentially computers, they have processors, RAM and run a firmware which out of the reach of the average user (i say this because there are people who have managed to hack these firmwares and use sd-cards as microcontrollers). the firmware does things like wear leveling, which can apparently even occur when the OS is shut down.

from all of this it follows that it is not wise to invest much in flash media (unless it come with a mega warranty, and even then expect occasional data loss - i have had two sepreate usb sticks sent back to the manufacturer twice and replace with a new one that had to be sent back also). people who use them frequently (for example people running RPi's usually backup the entire image and then when bad stuff happens they reflash it to the same media or to a new one. they are temporary devices for moving data from point A to point B bur not for storage.

personally, have noticed that they are also very poorly tolerant to heat, and that this appears to be worse with the smaller form factor ones, like the really stub/miniscule usb sticks. on the RPi forums there are several reports of manufactures not accpeting to refund broken sd-cards under warranty because they were used in applications where they are in constant use. i suspect that this has to do with them not having cooling systems, and they therefore work if you only pop them in and move a few files for a few mins max. anything more than that causes heat and significant wear.

Post Reply