You are not logged in.

#1 2014-11-03 19:03:54

morteza
Member
Registered: 2012-12-26
Posts: 15

format read only usb flash

hi guys,
I've an usb (8GB) after I installed kaspersky bootable rescue disk I couldn't remove or format flash.
I tried mkfs.vfat & gpart & partitionmanager in kde

Offline

#2 2014-11-03 19:38:40

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: format read only usb flash

What errors are you getting?

Offline

#3 2014-11-03 21:01:15

morteza
Member
Registered: 2012-12-26
Posts: 15

Re: format read only usb flash

Can't write to /dev/sdb, because it is opened read-only.

Offline

#4 2014-11-03 21:14:56

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: format read only usb flash

What happens if you unmount it and use sudo to repartition and reformat it?

Offline

#5 2014-11-03 21:33:54

nstgc
Member
Registered: 2014-03-17
Posts: 393

Re: format read only usb flash

I had an issue with that as well. I dd'ed the Arch iso, but I couldn't get back all of the space. Eventually I did do something to get it all back, but I can't remember what.

Offline

#6 2014-11-03 21:37:23

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,578
Website

Re: format read only usb flash

Some devices have a hardware switch to prevent writes. I'm not sure if USB sticks have ever had that functionality, but it might be worth checking, just in case you've accidentally toggled it.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#7 2014-11-04 04:40:49

morteza
Member
Registered: 2012-12-26
Posts: 15

Re: format read only usb flash

karol wrote:

What happens if you unmount it and use sudo to repartition and reformat it?


I tried by fdisk and the error was:

The partition table has been altered.
Calling ioctl() to re-read partition table.
/dev/sdb: close device failed: Input/output error

Offline

#8 2014-11-04 08:28:16

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: format read only usb flash

OK, so run dmesg, connect this drive, run

head -c1k /dev/sdb >file && cat file >/dev/sdb

and re-run dmesg (this may damage data on the pendrive if something goes wrong, I assume you are OK with that).

Post all new lines that appeared in dmesg when you ran it the second time ("new high-speed USB device" and so on).

Offline

#9 2014-11-04 08:37:40

morteza
Member
Registered: 2012-12-26
Posts: 15

Re: format read only usb flash

mich41 wrote:

OK, so run dmesg, connect this drive, run

head -c1k /dev/sdb >file && cat file >/dev/sdb

and re-run dmesg (this may damage data on the pendrive if something goes wrong, I assume you are OK with that).

Post all new lines that appeared in dmesg when you ran it the second time ("new high-speed USB device" and so on).

head: lk: invalid number of bytes

Offline

#10 2014-11-04 08:53:35

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: format read only usb flash

1k (one-k, as in "one kilobyte"), not lk. And post lines which get added to dmesg output when you connect the drive and run this.

You may also post output of

tail /sys/block/sdb/r*

for good measure.

Last edited by mich41 (2014-11-04 09:04:48)

Offline

#11 2014-11-04 12:33:59

morteza
Member
Registered: 2012-12-26
Posts: 15

Re: format read only usb flash

mich41 wrote:

1k (one-k, as in "one kilobyte"), not lk. And post lines which get added to dmesg output when you connect the drive and run this.

You may also post output of

tail /sys/block/sdb/r*

for good measure.


sudo head -c1k /dev/sdb >file && cat file >/dev/sdb
bash: /dev/sdb: Permission denied


sudo tail /sys/block/sdb/r*
==> /sys/block/sdb/range <==
16

==> /sys/block/sdb/removable <==
1

==> /sys/block/sdb/ro <==
0

Offline

#12 2014-11-04 14:15:09

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: format read only usb flash

Sudo is a pain to use with file redirections, use su instead.

If 'ro' is 0, the kernel doesn't believe the device is read only. You need to check dmesg to see what's really going on.

Offline

#13 2014-11-04 14:33:34

morteza
Member
Registered: 2012-12-26
Posts: 15

Re: format read only usb flash

dmesg output is:

[  194.900344] usb 2-2: new high-speed USB device number 3 using ehci-pci
[  200.016793] usb 2-2: device descriptor read/64, error -71
[  200.459575] usb-storage 2-2:1.0: USB Mass Storage device detected
[  200.459710] scsi host2: usb-storage 2-2:1.0
[  200.459848] usbcore: registered new interface driver usb-storage
[  200.462201] usbcore: registered new interface driver uas
[  201.461472] scsi 2:0:0:0: Direct-Access     JetFlash Transcend 8GB    8.07 PQ: 0 ANSI: 2
[  201.466264] sd 2:0:0:0: [sdb] 15687680 512-byte logical blocks: (8.03 GB/7.48 GiB)
[  201.466876] sd 2:0:0:0: [sdb] Write Protect is off
[  201.466884] sd 2:0:0:0: [sdb] Mode Sense: 03 00 00 00
[  201.467511] sd 2:0:0:0: [sdb] No Caching mode page found
[  201.467518] sd 2:0:0:0: [sdb] Assuming drive cache: write through                                                  
[  201.479153]  sdb: sdb1
[  201.481757] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[  373.667900] cfg80211: Calling CRDA to update world regulatory domain
[ 1461.637851] perf interrupt took too long (2544 > 2495), lowering kernel.perf_event_max_sample_rate to 50100
[ 5662.434764] perf interrupt took too long (4996 > 4960), lowering kernel.perf_event_max_sample_rate to 25200
[ 7248.393740] sd 2:0:0:0: [sdb]  
[ 7248.393752] Result: hostbyte=0x00 driverbyte=0x08
[ 7248.393759] sd 2:0:0:0: [sdb]  
[ 7248.393764] Sense Key : 0x2 [current] 
[ 7248.393772] Info fld=0x0
[ 7248.393778] sd 2:0:0:0: [sdb]  
[ 7248.393782] <<vendor>> ASC=0xff ASCQ=0xffASC=0xff <<vendor>> ASCQ=0xff
[ 7248.393791] sd 2:0:0:0: [sdb] CDB: 
[ 7248.393795] cdb[0]=0x2a: 2a 00 00 00 00 00 00 00 08 00
[ 7248.393816] end_request: I/O error, dev sdb, sector 0
[ 7248.393825] Buffer I/O error on device sdb, logical block 0
[ 7248.393830] lost page write due to I/O error on sdb
[ 7248.993670] sd 2:0:0:0: [sdb] Write Protect is on
[ 7248.993677] sd 2:0:0:0: [sdb] Mode Sense: 03 00 80 00
[ 7249.000140]  sdb: sdb1
[ 7328.412684] raid6: sse2x1    3012 MB/s
[ 7328.469327] raid6: sse2x2    3079 MB/s
[ 7328.526004] raid6: sse2x4    3540 MB/s
[ 7328.526011] raid6: using algorithm sse2x4 (3540 MB/s)
[ 7328.526014] raid6: using ssse3x2 recovery algorithm
[ 7328.583897] xor: measuring software checksum speed
[ 7328.615969]    prefetch64-sse:  8005.200 MB/sec
[ 7328.649321]    generic_sse:  7046.400 MB/sec
[ 7328.649327] xor: using function: prefetch64-sse (8005.200 MB/sec)
[ 7328.766567] Btrfs loaded
[ 7328.865929] JFS: nTxBlock = 8192, nTxLock = 65536
[ 7328.892242] NILFS version 2 loaded
[ 7329.002056] SGI XFS with ACLs, security attributes, realtime, no debug enabled
[ 7330.208007]  mmcblk0: p1
[ 7360.645827] mmcblk0: error -110 transferring data, sector 7744248, nr 8, cmd response 0x900, card status 0x80000b00
[ 7360.645836] mmcblk0: retrying using single block read
[ 7360.924458]  mmcblk0: p1

Last edited by morteza (2014-11-05 03:13:58)

Offline

#14 2014-11-04 16:16:17

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: format read only usb flash

Please use code tags when pasting to the boards: code
https://wiki.archlinux.org/index.php/Fo … s_and_Code


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#15 2014-11-04 17:10:41

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: format read only usb flash

This is a low level hardware problem. Probably the flash memory has died. Test it on some other machine.

Offline

Board footer

Powered by FluxBB