chris_c
Posts: 156
Joined: Sun May 06, 2012 10:23 am

SD power loss corruption

Sat Nov 08, 2014 11:06 pm

I've noticed (with my original B model running raspbian) that should I loose power suddenly or hard lock my Pi I'm very likely to get corruption on the SD card.

Has anyone noticed any differences with different models of Pi's - could it be an electronic issue (some kind of spike)?

Has anyone noticed more robust behaviour with different types of SD cards (tried a few types without particularly noticing a difference)

I'm considering a number of options to mitigate or even hopeful make this a non issue

disable caching

checking to see if journalling is enabled (never noticed anything about journals being rolled back??)

mount SD read only and pass boot onto usb media as early in the boot process as possible (/boot only on SD root elsewhere)
maybe a usb stick might be more reliable

any ideas / thoughts welcome!

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 14573
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: SD power loss corruption

Sun Nov 09, 2014 12:38 am

cards do their own cashing, on top of that they can do write/wear leveling at any moment. thats why the card must be told to flush its cache, and finish it wear leveling operations, lest some of the sectors that are used may contain random data.

that is why even after the OS reported it has shut down you must give the card a few more seconds before pulling the plug

chris_c
Posts: 156
Joined: Sun May 06, 2012 10:23 am

Re: SD power loss corruption

Sun Nov 09, 2014 12:45 am

Yeah this I know but there must be a way to mitigate the issues, not mounting the /boot partition via fstab seems to help with that partition (which is rather critical)

I do wonder if root on usb might work better after all...

chris_c
Posts: 156
Joined: Sun May 06, 2012 10:23 am

Re: SD power loss corruption

Sun Nov 09, 2014 12:48 am

Its just occurred to me that for the time I had a working Pandora I never had these problems on lockups (power loss was never an issue) so I do wonder about the Pi's SD circuitry....

Its not just power loss but also lockups that can cause the issues on the Pi.

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK

Re: SD power loss corruption

Sun Nov 09, 2014 10:17 am

I'm still convinced its an SD Make/Size/Class thing. I run 8GB Sandisk Class 4. Only once had a problem with SD card corruption in over 2 years. Despite my main Pi running 24/7 for over 18 months being deprived of power (Power failures / ECD trips) on a fairly regular basis. Smaller, cheaper cards have much lower likelihood of being fakes- When a genuine costs about £4, there's no money in making fakes. Now with 32GB+ & Class 10 that's a different story.....

If I had the need for huge amounts of storage on a Pi, I's use spinning rust plugged into a USB port.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

shuckle
Posts: 565
Joined: Sun Aug 26, 2012 11:49 am
Location: Finland

Re: SD power loss corruption

Sun Nov 09, 2014 10:23 am

It is also worth trying with the latest versions.
sudo apt-get update
sudo apt-get upgrade
sudo rpi-update

I have not suffered these corruptions, butI have seen discussions where they have vanished with the fresh versions.

Return to “Advanced users”