Re: Flash Drive suddenly read only?
On Sun 31 Jan 2021 at 20:30:22 (+0800), kaye n wrote:
> On Sun, Jan 31, 2021 at 5:20 PM <firstname.lastname@example.org> wrote:
> > On Sat, Jan 30, 2021 at 11:27:52PM -0700, Charles Curley wrote:
> > > On Sun, 31 Jan 2021 14:00:31 +0800 kaye n wrote:
> > >
> > > > When I plug in my usb flash drive to my desktop computer, I can edit
> > > > certain libreoffice calc files saved in that flash drive. But after I
> > > > try to copy several dbf files from the desktop computer hard drive to
> > > > the flash drive via the terminal, it says it's read only. When I open
> > > > the calc files again, they are now read only and cannot be edited.
This is written as if it has happened more than once (but that could
be your English). I'm going to assume this happened just once, and the
stick's readonly state is permanent.
> > If there's an event forcing the OS to put the file system in read-only
> > mode (e.g. write error), you will see traces of it in the system logs.
OTOH if the stick does this itself, there may be no trace at all, but
just a sudden change from rw to ro. You need to determine which.
> How long has this been going on?
> Just last night
> What do the logs say? /var/log/syslog, or .../messages?
> I fail to open it
That suggests you should put yourself in the adm group so that you
can read them. (I'm assuming you "own" the machine.)
If the mount looks good for writing, and the file permissions look
good too, then I would suspect the firmware in the stick itself.
(Note—none of my sticks has a hardware switch on it. Does yours?)
Presumably you've checked it out in windows, too.
You're obviously running some sort of automounter, and I don't.
Others might need to help you with keeping the stick in an unmounted
state, which is recommended, but probably not essential, to perform
the actions below. Desktop Environments and automounters like to
get in the way, and dealing with them is above my pay-grade.
My own course of action would be:
Physically mark the stick as suspect/ephemeral/for scratch use.
Back up the files on the stick, BUT treat them all as suspect.
They might already have been corrupted by partially successful
Zero the drive with dd from /dev/zero, carefully, ie making
sure you're writing to the correct device. (Needs root.)
Unplug/reinsert/try using elsewhere, to see whether the stick
is now unusable/has been zeroed:
If zeroing was successful, repartition and reformat the stick,
and keep it just for unimportant uses, eg if you use it to
play videos/music/slide shows on your TV. (Needs root.)
If your dbf/calc files are still present, zeroing was unsuccessful,
so perform funeral rites. The stick's continued existence may
present a security risk, like discarded papers. (Needs a hammer.)