madinga
Posts: 6
Joined: Tue Aug 13, 2013 5:57 am

SD card locked

Tue Aug 13, 2013 6:12 am

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!

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1440
Joined: Sat Sep 10, 2011 11:43 am

Re: SD card locked

Tue Aug 13, 2013 6:32 am

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
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: SD card locked

Tue Aug 13, 2013 6:51 am

Try using a camera to format the SD Card.
I had the same issue with mine.
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

madinga
Posts: 6
Joined: Tue Aug 13, 2013 5:57 am

Re: SD card locked

Tue Aug 13, 2013 7:42 am

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.

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1440
Joined: Sat Sep 10, 2011 11:43 am

Re: SD card locked

Tue Aug 13, 2013 9:06 am

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
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

madinga
Posts: 6
Joined: Tue Aug 13, 2013 5:57 am

Re: SD card locked

Tue Aug 13, 2013 9:55 am

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ł

User avatar
RaTTuS
Posts: 10459
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: SD card locked

Tue Aug 13, 2013 10:15 am

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
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

madinga
Posts: 6
Joined: Tue Aug 13, 2013 5:57 am

Re: SD card locked

Sat Aug 17, 2013 6:00 pm

It's sent. Please let me know when you get it.
And of course the results of the testing...
Michal

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1440
Joined: Sat Sep 10, 2011 11:43 am

Re: SD card locked

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
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: SD card locked

Thu Aug 22, 2013 7:01 pm

Would it be possible for some cameras to be able to reset that temporary write bit ?
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

User avatar
modmypi
Authorised Reseller
Authorised Reseller
Posts: 62
Joined: Mon Mar 19, 2012 9:41 am
Contact: Website

Re: SD card locked

Mon Sep 16, 2013 7:57 am

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.
Raspberry Pi Cases for your Raspberry Pi! Unique, colourful, customisable designs available from ModMyPi now!

madinga
Posts: 6
Joined: Tue Aug 13, 2013 5:57 am

Re: SD card locked

Mon Sep 16, 2013 9:04 am

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.

godlover9000
Posts: 1
Joined: Sat Nov 08, 2014 5:34 pm

Re: SD card locked

Sat Nov 08, 2014 5:46 pm

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.

madinga
Posts: 6
Joined: Tue Aug 13, 2013 5:57 am

Re: SD card locked

Sat Nov 08, 2014 6:45 pm

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

User avatar
bleep42
Posts: 153
Joined: Wed Mar 07, 2012 12:43 pm
Location: Sussex

Re: SD card locked

Thu Aug 24, 2017 3:30 pm

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.

jonart
Posts: 3
Joined: Sat Nov 19, 2016 9:09 pm

Re: SD card locked

Tue Oct 03, 2017 3:45 pm

I have same problem. Anybody can find solved?

kaksi
Posts: 92
Joined: Tue Mar 10, 2015 6:19 am

Re: SD card locked

Tue Oct 17, 2017 12:01 pm

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

rln
Posts: 174
Joined: Wed Apr 09, 2014 1:43 pm
Location: Sweden
Contact: Website

Re: SD card locked

Thu Oct 19, 2017 8:42 am

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/
Author of the robust Nard distro http://www.nard.se

Sawadee
Posts: 3
Joined: Thu Mar 29, 2018 12:52 pm

Re: SD card locked

Fri Nov 16, 2018 3:14 pm

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

User avatar
HawaiianPi
Posts: 4616
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SD card locked

Fri Nov 16, 2018 8:35 pm

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).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Return to “Beginners”