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 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,235

Rep: Reputation: 621Reputation: 621Reputation: 621Reputation: 621Reputation: 621Reputation: 621
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,375

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,294

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 Today, 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.
 
  


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 04:55 PM.

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