Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 00:08 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : USB drive keeps saying it's write-protected....

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9306
Posted: 12:46am 19 Aug 2024
Copy link to clipboard 
Print this post

This started happening today, to my BACKUP USB flash drive.
The drive is a SanDisk 64GB USB3 compact/low profile.

It's always plugged in, and I use it for backup purposes, but NOT MY ONLY BACKUP.
It is the local backup, but I also have a backup server, and cloud-storage backup, so I don't really care if this drive dies - I have multiple redundant backups.

However, this is interesting, cos as far as I know, with most standard USB flash drives, you CANNOT write-protect them - you can always write to them, provided there is space.  This drive has 11GB free.

But if I try to copy ANY file to it, Windoze throws an error:





Have unplugged it, tried it in other ports, even tried it on Linux, but Linux can't write to it either - reports the same problem, that it is write-protected when it isn't.

Now, I know that ALL flash media has a limited life, so I am just wondering if the drive itself has simply put itself into read-only mode, as it has detected that the flash cells are worn out, or the controller was otherwise detecting that writing was starting to be a problem for it.

That's the theory I am going on right now - does that sound plausible?
Smoke makes things work. When the smoke gets out, it stops!
 
Rickard5

Guru

Joined: 31/03/2022
Location: United States
Posts: 463
Posted: 02:43am 19 Aug 2024
Copy link to clipboard 
Print this post

@ Grogster, Have you tried Looking at the Properties of that flash drive in Windows? the Read Only Flag may be checked. and or check drive permissions in Linux
I may be Vulgar, but , while I'm poor, I'm Industrious, Honest,  and trustworthy! I Know my Place
 
EDNEDN
Senior Member

Joined: 18/02/2023
Location: United States
Posts: 118
Posted: 01:43pm 19 Aug 2024
Copy link to clipboard 
Print this post

If you are sure you have another backup...    I would run H2TESTW on it.   There are a huge number of 'fake' flash drives out there that do not really have the capacity that they claim to have.   I have seen this type of behavior on illegitimate USB Flash Drives.

Any flash drive (or SD Memory card) I buy on eBay gets subjected to a H2TESTW scan operation before it is used anywhere.    And the honest truth is half of the devices from eBay blatantly fail the test.

https://www.h2testwofficial.com/

(H2TESTW is best used with an empty file system.   You would probably want to format the drive prior to the test.  As H2TESTW fills up the drive with unique data patterns, it can tell if some of the blocks are mapped into multiple locations on the drive.)
Edited 2024-08-20 00:13 by EDNEDN
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3800
Posted: 03:51pm 19 Aug 2024
Copy link to clipboard 
Print this post

Or, on Linux, f3

John
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2120
Posted: 04:31pm 19 Aug 2024
Copy link to clipboard 
Print this post

This shows a fake drive in seconds and keeps existing data
https://www.grc.com/validrive.htm
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 07:25pm 19 Aug 2024
Copy link to clipboard 
Print this post

I have had this happen on a SD card, it suddenly became read only, couldn't do anything to make it writable again, I was told it was because it had had some terminal internal error, so locked itself to preserve the data it had as read only. I have no idea if this is a real thing or not, I eventually threw the SD card away.
Regards Kevin
 
EDNEDN
Senior Member

Joined: 18/02/2023
Location: United States
Posts: 118
Posted: 08:28pm 19 Aug 2024
Copy link to clipboard 
Print this post

I like that Validrive program!   I just downloaded it and gave it a try.    

It can find fake USB drives very fast.   I think I'll use it for a first pass in future verifications.   And then still do a complete test of every block on the device with H2TESTW.

The good thing about Validrive is it can detect fake USB drives very quickly because it is spot checking blocks all over the volume.    H2TESTW uses the file system to fill up the volume and the file system typically allocate blocks from the front end of the volume first.     Until all the 'good' blocks have been allocated and used you won't see a problem and that takes a fair amount of time.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9306
Posted: 03:49am 20 Aug 2024
Copy link to clipboard 
Print this post

Thanks for all the pointers.  I can confirm, that this is a genuine SanDisk product, as I bought it here in NZ from one of the computer shops.  It has been very good up until now, and I suspect it has simply locked itself to protect the contents.

Flash-drives are cheap an plentiful, so it won't be an issue for me to replace it.

I'll check out validrive though, as I have never heard of that.
Smoke makes things work. When the smoke gets out, it stops!
 
PilotPirx

Regular Member

Joined: 03/11/2020
Location: Germany
Posts: 68
Posted: 09:19am 20 Aug 2024
Copy link to clipboard 
Print this post

As far as I know, there are two reasons for a Write Protect (read only).

1. Wear leveling protects the data carrier as the error rate increases significantly. This can happen when the card has reached the maximum write/erase cycles. This process is normally irreversible. If there is a manufacturer tool with which you can read out the flash status (like SMART) you could check this.

2. the Write Protect flag was set due to an error condition. This can be reset under Windows with “diskpart”:

- Hit Windows Key + X on your keyboard, and select Command Prompt (Admin) from the menu.

- Type diskpart and press Enter.

- Type list disk and press Enter.

- Type select disk #(ex: Disk 1) to select the disk which is write-protected and press Enter.

- Type attributes disk clear readonly to change the disk’s properties so that it is no longer read-only and press Enter.

- Type exit and press Enter twice to exit Diskpart and Command Prompt continuously. Re-plug your USB flash drive to check if the write protection error is solved.
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024