Page 1 of 1

SD card locked

Posted: Tue Aug 13, 2013 6:12 am
by madinga
I have tried to "low level" reformat my 8GB SD card after using it with NOOBS 1.1 using multiple methods, but without success.
Windows format certainly doesn't work because the card has got multiple non-Win partitions.
Still, even low level formatting with SDFormatter returns "write protection" error, even if the card seems to accept writing of files.
Linux fdisk can't change the partition table. All changes after writing the new partition tabel got discarded and the SD returns ot the original partitions "untouched".
The same with gparted (run as standard program and booted from gparted ISO rescue disk) - it shows some errors in the partition table and if trying to overwrite it it returns to original state.

I have even tried to use dd to overwrite the entire card and erase it totally. The command runs without any error, but then miracle happens and the contents of the card are still visible. Like the card was ignoring the write attempts.

Any suggestions if this card can be rescued?
I have seen the post that NOOBS 1.1 was making the partition table somehow non-standard way so the formatting tools were not able to clear the card. But this one seems really strange, like the card is locked.
Please help!

Re: SD card locked

Posted: Tue Aug 13, 2013 6:32 am
by gsh
Are you sure the write protection slider is in the right place (although if it wasn't I'd expect some kind of error message about it being mounted read only etc..)

NOOBs itself cannot break a device this way its more serious than just writing the partition table (although the original NOOBS partition table is non standard it's not broken in any way). I think its likely that the SDCard is physically broken somehow...

Gordon

Re: SD card locked

Posted: Tue Aug 13, 2013 6:51 am
by SirLagz
Try using a camera to format the SD Card.
I had the same issue with mine.

Re: SD card locked

Posted: Tue Aug 13, 2013 7:42 am
by madinga
The card is not locked by a physical switch/slider. Sliding it to "locked" position returns other error messages.
It looks like some sort of low level security mechanism got engaged preventing the overwrite of MBR/partition table.
Maybe NOOBS has overwritten some part of SD card which locks this area?

I have tried formatting in Olympus camera, but it returned "card is read-only". I will try with another one.

Re: SD card locked

Posted: Tue Aug 13, 2013 9:06 am
by gsh
Interesting, there is a permanent SD write protect mechanism in the spec, but we never write to it...

Of course it could have been some sort of bug that has written this, but I would have thought Linux would have noticed it...

Would you be able to send me the SDCard at PiTowers and I might be able to understand at least whether this is the case...

Thanks

Gordon Hollingworth

Raspberry Pi,
Mount Pleasant House,
Mount Pleasant,
Cambridge,
CB3 0RN

Re: SD card locked

Posted: Tue Aug 13, 2013 9:55 am
by madinga
It all started from a Raspbian crash which corrupted the fs.
I was first trying to recreate the Raspbian partition from the NOOBS interface - the process looks ok and reports everything is fine with writing to the card, but then when the system boots it's still the same old corrupted partition.
Even trying to swtich to other image (like Raspbmc) from the boot interface has the same effect: writing reports everything is fine, but then it boots to Raspbian with all error messages. Pure magic.

I can send you the card if some deeper investigation is needed. Let me know the address.
Michał

Re: SD card locked

Posted: Tue Aug 13, 2013 10:15 am
by RaTTuS
madinga wrote:....
I can send you the card if some deeper investigation is needed. Let me know the address.
Michał
the address is mentioned in the previous post

Re: SD card locked

Posted: Sat Aug 17, 2013 6:00 pm
by madinga
It's sent. Please let me know when you get it.
And of course the results of the testing...
Michal

Re: SD card locked

Posted: Thu Aug 22, 2013 3:15 pm
by gsh
OK,

Had a look at your card this morning and it looks like the temporary write protect bit is set on the SDCard... Don't know how that has happened but that's what it looks like!

Am going to look for a method of resetting that bit and then see if I can find how it got set!

Gordon

Re: SD card locked

Posted: Thu Aug 22, 2013 7:01 pm
by SirLagz
Would it be possible for some cameras to be able to reset that temporary write bit ?

Re: SD card locked

Posted: Mon Sep 16, 2013 7:57 am
by modmypi
SirLagz wrote:Would it be possible for some cameras to be able to reset that temporary write bit ?
We've managed to save a great number of SD cards by simply using a digital camera to format them.

They seem to ignore difference partitions and boot types, and just totally wipe the things back to standard.

Re: SD card locked

Posted: Mon Sep 16, 2013 9:04 am
by madinga
I have tried to do the format in two cameras, but it hasn't succeeded.
I think that Raspbian has changed the permament write protection bit on the SD card and now it's the SD card hw blocking the write attempts. Second card from Goodram started to behave exactly the same way after several reboots caused by power outage.

Re: SD card locked

Posted: Sat Nov 08, 2014 5:46 pm
by godlover9000
I had this problem too. If you have access to a Windows machine you can open command prompt (right click command prompt and click "run as administrator". once it is open type "DiskPart" and then type "list disk" and find the disk in the list that is the same size as your SD card and then type "select disk [disk number]" (be very careful that you select your SD card and not your Hard Drive). after that you will type "clean". it may give you an error but that does not mean it has not succeeded (it has wiped all partitions including the locked one). you are now free to repartition the disk however you need to.
I hope this helped.

Re: SD card locked

Posted: Sat Nov 08, 2014 6:45 pm
by madinga
It didn't work with my card as the global readonly bit was set by the RaspberryPi during one of the reboots.
The card become a ROM basically with no modification possible. So no formatting in the camera or using superuser account was effective. From OS level it tried to write over, but the SD physical still layer did not allow any modification.
I still do not know what was the result of the investigation of my particular card though and how to prevent this happen again...

Re: SD card locked

Posted: Thu Aug 24, 2017 3:30 pm
by bleep42
gsh wrote:
Thu Aug 22, 2013 3:15 pm
OK,

Had a look at your card this morning and it looks like the temporary write protect bit is set on the SDCard... Don't know how that has happened but that's what it looks like!

Am going to look for a method of resetting that bit and then see if I can find how it got set!

Gordon
Hi Gordon,
Did you manage to fix this, as I now have 2 cards with the same problem?
Regards,
Kevin.

Re: SD card locked

Posted: Tue Oct 03, 2017 3:45 pm
by jonart
I have same problem. Anybody can find solved?

Re: SD card locked

Posted: Tue Oct 17, 2017 12:01 pm
by kaksi
I have this problem quite often when the power goes down. If SDformatter cannot cope with it, I throw it. Years ago, I read somewhere there is a built-in mechanism locking the card if it starts to make errors in order not to overwrite good data with trash. Makes some sense, but even an unreliable card still can be used for test purposes.

A good idea would be to run the OS from RAM - it is possible, there is a tutorial, unfortunately too complicated for me.

Thing seem seem to go better since I turned off (most) logs:

sudo nano /etc/systemd/journald.conf
change #Storage=auto
to Storage=volatile

Re: SD card locked

Posted: Thu Oct 19, 2017 8:42 am
by rln
kaksi wrote:
Tue Oct 17, 2017 12:01 pm
A good idea would be to run the OS from RAM - it is possible, there is a tutorial, unfortunately too complicated for me.
Running from RAM is easy - just have a go with my Nard distro. It's designed for minimal SD card wear.
http://www.nard.se/

Re: SD card locked

Posted: Fri Nov 16, 2018 3:14 pm
by Sawadee
I have three cards with the same issue. One used 6 months the others less than 2 months. 16G and two 64G SDmicro cards.
Tried diskpart. Does not allow me to set partition. Only have partition 1
Select part 1 and Select partition 1 return the same note. No partition selected. But List Part show Partition 1.....

Not a slide lock issue. Some bit has been set on these cards that locks them. I can read but not write or reformat...

Re: SD card locked

Posted: Fri Nov 16, 2018 8:35 pm
by HawaiianPi
Sawadee wrote:
Fri Nov 16, 2018 3:14 pm
Not a slide lock issue. Some bit has been set on these cards that locks them. I can read but not write or reformat...
This is a failure mode for SD cards. If the controller detects a fatal error it locks the card read-only to preserve existing data (for recovery). This typically means the card is no longer usable and needs to be replaced. A google search will find loads of results and "how to fix this" articles, but in my experience none work (this can't be fixed, just get a new card).