LinuxQuestions.org
Visit Jeremy's Blog.
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 10-05-2025, 02:46 PM   #1
exerceo
Member
 
Registered: Oct 2022
Posts: 159

Rep: Reputation: 31
Question USB stick refuses to leave read-only mode. How to make it writable again?


[Log in to get rid of this advertisement]
dmesg:
Code:
[2304237.356095] scsi 5:0:0:0: Direct-Access      USB      SanDisk 3.2Gen1 1.00 PQ: 0 ANSI: 6
[2304237.356396] sd 5:0:0:0: Attached scsi generic sg4 type 0
[2304237.356778] sd 5:0:0:0: [sdd] 60063744 512-byte logical blocks: (30.8 GB/28.6 GiB)
[2304237.359283] sd 5:0:0:0: [sdd] Write Protect is on
[2304237.359287] sd 5:0:0:0: [sdd] Mode Sense: 43 00 80 00
[2304237.359617] sd 5:0:0:0: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
hdparm:
Code:
# hdparm -r0 /dev/sdd

/dev/sdd:
 setting readonly to 0 (off)
 readonly      =  1 (on)
It's a SanDisk Ultra USB stick. It's fully readable and no data is corrupted.

It is also write-protected on a different computer, so the issue is with the USB stick.

If there is no way to get it writing again, it's not that big of a loss, but it would be nice to have it working again.
 
Old 10-05-2025, 03:16 PM   #2
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 2,237

Rep: Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622
I'm not familiar with that model. Dmesg says write protect is on. Is there a physical switch on the device? SD cards have a write-protect switch, but I don't know about that device. If there is no switch, the drive is possibly failing. Becoming read-only is a classic failure mode for flash drives.

Last edited by sgosnell; 10-05-2025 at 03:18 PM.
 
Old 10-05-2025, 03:44 PM   #3
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,642
Blog Entries: 7

Rep: Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074
How about this:
https://askubuntu.com/questions/1016...protection-off
 
Old 10-05-2025, 08:33 PM   #4
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,376

Rep: Reputation: 488Reputation: 488Reputation: 488Reputation: 488Reputation: 488
Question

Quote:
Originally Posted by exerceo View Post
dmesg:
Code:
[2304237.356095] scsi 5:0:0:0: Direct-Access      USB      SanDisk 3.2Gen1 1.00 PQ: 0 ANSI: 6
[2304237.356396] sd 5:0:0:0: Attached scsi generic sg4 type 0
[2304237.356778] sd 5:0:0:0: [sdd] 60063744 512-byte logical blocks: (30.8 GB/28.6 GiB)
[2304237.359283] sd 5:0:0:0: [sdd] Write Protect is on
[2304237.359287] sd 5:0:0:0: [sdd] Mode Sense: 43 00 80 00
[2304237.359617] sd 5:0:0:0: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
hdparm:
Code:
# hdparm -r0 /dev/sdd

/dev/sdd:
 setting readonly to 0 (off)
 readonly      =  1 (on)
It's a SanDisk Ultra USB stick. It's fully readable and no data is corrupted.

It is also write-protected on a different computer, so the issue is with the USB stick.

If there is no way to get it writing again, it's not that big of a loss, but it would be nice to have it working again.
some usb stick, got a slide switch to make the USB read only. I am not sure whether that USB stick got one, check on it.

or try:
sudo mount -o remount,rw /dev/sdd /mnt/usbpoint

Last edited by JJJCR; 10-05-2025 at 08:37 PM. Reason: edit
 
Old 10-06-2025, 10:00 AM   #5
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,943

Rep: Reputation: 1714Reputation: 1714Reputation: 1714Reputation: 1714Reputation: 1714Reputation: 1714Reputation: 1714Reputation: 1714Reputation: 1714Reputation: 1714Reputation: 1714
Is the partition table something other than msdos or gpt?
 
Old 10-06-2025, 11:02 AM   #6
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,295

Rep: Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381
Linux makes usb sticks read-only when the filing system seems to be corrupt to prevent you making it even worse.

The first step is to use fsck to see if it will clean up the device. If that works, you are probably OK.

If fsck doesn't work, or if the device gives trouble again in the future, you need to save the contents and reformat it. Gparted should work, but if it won't, you may still be able to rescue the thing. Unmount, after noting its /dev name, and run this command after which gparted should work.
Code:
dd if=/dev/zero bs=1M count=10 of=/dev/whatever
If you have further trouble, then the only solution is replacement
 
Old 10-09-2025, 04:51 PM   #7
exerceo
Member
 
Registered: Oct 2022
Posts: 159

Original Poster
Rep: Reputation: 31
Question

Quote:
Originally Posted by JJJCR View Post
some usb stick, got a slide switch to make the USB read only. I am not sure whether that USB stick got one, check on it.
A physical switch?
Quote:
or try:
sudo mount -o remount,rw /dev/sdd /mnt/usbpoint
Doesn't work. It seems to be on a hardware level.

Quote:
Originally Posted by DavidMcCann View Post
If you have further trouble, then the only solution is replacement
I did some research and my closest guess would be that firmware of the USB stick refuses to write any more because it reached its end of life, as suggested by this post by AnthonyNYC from the now defunct CNET forum.

I used it as for a portable Linux installation for some time, so it might have been exposed to workloads it wasn't designed for. But it still reads at solid 140 MB/s, which is close to its advertised speed of 150 MB/s. And it never had corrupted data. But it shouldn't anyway, because that's expected from a reputable brand. Maybe SanDisks's firmware is "over-cautious" and pre-emptively write-protected it.
 
Old Yesterday, 12:29 AM   #8
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,376

Rep: Reputation: 488Reputation: 488Reputation: 488Reputation: 488Reputation: 488
From this link: https://darwinsdata.com/what-happens...s-write-limit/

It says:
However, an SSD past its write endurance may still be readable for months or years in a read-only state.

Maybe true for older ssd's, for newer ssd's I believe this is not applicable anymore.
 
Old Yesterday, 02:47 AM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 25,024

Rep: Reputation: 8207Reputation: 8207Reputation: 8207Reputation: 8207Reputation: 8207Reputation: 8207Reputation: 8207Reputation: 8207Reputation: 8207Reputation: 8207Reputation: 8207
Quote:
Originally Posted by exerceo View Post
Doesn't work. It seems to be on a hardware level.
Yes, probably a real switch. Or a corrupted filesystem. Or a damaged device. Or a damaged usb port.
Attached Thumbnails
Click image for larger version

Name:	usb-with-lock-switch.jpg
Views:	2
Size:	38.0 KB
ID:	45253  
 
Old Yesterday, 05:31 AM   #10
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7 / 8
Posts: 3,589

Rep: Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626
Sandisk will go read-only at the USB controller firmware level if it detects too many errors. Back stuff up and throw it in the bin or shred it.
 
Old Yesterday, 06:30 AM   #11
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 14,044
Blog Entries: 48

Rep: Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275
Member Response

Hi,

No " SanDisk Ultra USB stick" have a physical protect switch.
 
Old Yesterday, 07:01 AM   #12
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7 / 8
Posts: 3,589

Rep: Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626
Quote:
Originally Posted by onebuck View Post
Hi,

No " SanDisk Ultra USB stick" have a physical protect switch.
Yes, while they may have a physical protect switch, they ALSO have firmware that makes the drive read-only when errors are detected.

I'm not pulling this info out my butt, but from the research I previously did when I had a similar problem.
 
Old Yesterday, 07:34 AM   #13
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 14,044
Blog Entries: 48

Rep: Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275
Member Response

Hi,
You can check the Sandisk site to find none have a write protect physical switch but yes there are the means to switch via firmware.

EDIT: Some older SD/microSD cards do have a physical switch but no USB. As stated before if USB Sandisk is showing protected then it is software related.

Last edited by onebuck; Yesterday at 07:57 AM. Reason: add information
 
Old Yesterday, 08:19 AM   #14
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7 / 8
Posts: 3,589

Rep: Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626Reputation: 1626
Quote:
Originally Posted by onebuck View Post
Hi,
You can check the Sandisk site to find none have a write protect physical switch
I'm positive I had one "back in the day", although that could be obscured by the mists of time! Or maybe it was a thing then
 
Old Yesterday, 09:20 AM   #15
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 14,044
Blog Entries: 48

Rep: Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275Reputation: 3275
Member Response

Hi,
Quote:
Originally Posted by TenTenths View Post
I'm positive I had one "back in the day", although that could be obscured by the mists of time! Or maybe it was a thing then
A lot of off brand sometimes do have a write protect switch. But as I said before that some older SD/microSD cards do have a physical switch which is a standard but no consumer Sandisk USB Flash. As stated before if USB Sandisk is showing protected then it is software /firmware related via the controller or the system.

As one should consider a write protect switch is a potential failure point. Firmware/software level write protect is flexible plus a secure means to protect.
Hope this helps!
 
  


Reply

Tags
usb stick



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] Multiple config file not writable: Configuration file "home/$USER/.config/consolerc" not writable. Please contact your system administrator. andrewysk Linux - Newbie 8 05-16-2021 02:01 PM
How do I make read-only file system writable? Glenn D. Linux - Newbie 14 02-27-2017 09:41 AM
How to make read-only root partition writable again? aranea.network Linux - Desktop 2 09-13-2016 04:49 AM

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

All times are GMT -5. The time now is 07:42 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