Page 4 of 4

Re: SD cards - the Pi's greatest weakness

Posted: Wed Nov 29, 2017 10:38 pm
by Heater
rpdom,

Getting the order and timing of powering up and down different parts of a system can indeed make perfect sense.

For example: We might want to keep power on the Pi until the OS has cleaned up and shut down. We might then want to keep power on the SD until it's controller has done whatever it has to do.

Problem is the latter part. How long should that be? 100ms? A second? A minute? etc?

We have no idea what goes on in that SD's controller.

Sure someone could build such a power sequencing system and try it.

I suspect that no one is up for that. And how would we know when they got it right?

Re: SD cards - the Pi's greatest weakness

Posted: Wed Nov 29, 2017 10:51 pm
by i486
Imperf3kt wrote:
Wed Nov 29, 2017 9:47 pm
fanoush wrote:
Wed Nov 29, 2017 11:41 am
So maybe some capacitor on SD power pin would be enough to prevent damage of the card even when power plug is pulled in the middle of the write? Of course the filesystem would need check and fix but the card would not be damaged if it had a second to finish the write. Typically such capacitor should be inside the card but there is probably no space for such thing in microsd?
How would that help at all?
Lets say, theoretically, the cap will give the pi 1 second to complete its write cycle. Lets say this write takes 0.5 seconds.
What do you propose happens, if the power is pulled, and the Pi begins a write cycle 0.6 seconds later?
If power is pulled, the Pi (mcu) cannot begin a write cycle _later_. Write cycle is initiated with command sent from mcu to SD. If MCU has no power but SD has 1 sec delayed power, it can work without new commands.

The idea is good, the question is whether 1 second delay is enough. The risk of accidental power cut is not from damage of file system - it can be fixed in most cases. If the MCU has no power and does not send new commands to SD, but SD has additional power, it can finish last write operation and avoid corruption of currently overwritten flash page/region because of broken write.

Re: SD cards - the Pi's greatest weakness

Posted: Thu Nov 30, 2017 2:16 am
by Gavinmc42
Past Pi's verses current Pi's.

My first embedded Pi was an old A, still works after 6 years and only SD card corrupted twice.
I have only an anecdotal suspicion from back in the early Pi days.

I noticed with old Raspbian back then I had more SD card failures on model B's 5 years ago.
I suspected and still do suspect that any Pi connected to a network failed more often, sometimes it did so within 10 minutes.
What happens in Linux when they are networked I have no clue and no big incentive or skill to find out.

Backing up all those Raspbian 8GB cards for each project required us to get a backup server.
This was unsustainable so I went looking for a smaller OS and found PiCore, a TinyCore Linux spin for Arm cpu's.
PiCore boots and run on a ram drive, pull the plug and the OS is safe, might lose some data but after 4 years not a single one has crashed.

Raspbian and Linux has changed much since then, I won't say it is bullet proof but it is ok for desktop type use.
I will not use it for embedded myself but Pikrellcam uses Lite and my external usb drive camera installs have not crashed for 2+ years.
But I have had to swap the SD cards on the non external drive Pikrellcam as the vids and thumbs are saved to the SD card.
This has been required less as I keep updating to latest versions, they seem to be getting more reliable :D

The hardware has also changed, the original Pi's had linear voltage reg's the new ones have switchmode regs.
Again anecdotal, I feel the SW regs on the A+, B+ etc add more protection against power glitches.
MicroSDs are physically more rugged, lots of my cheap and not so cheap full size SD cards fell apart after years of use.

The reasons I am moving on from PiCore to Ultibo is from a security issue, OS size and Application Lifetime Management issue.
I don't need General Purpose OS for my embedded apps, a single purpose OS is fine, with the advantage the app is only KB's .

A UPS would be my next step, but to protect against a now very small failure rate, not sure if it is worth if for my stuff yet.
None of my stuff is of critical use, if it was, I may not be using Pi's, not that I would trust my coding skills either ;)
I do intend to do solar powered Zero's one day, these will have UPS stuff in them and perhaps industrial SLC based SD cards.

Not sure what else can be done after that? Different memory technology?

For Raspbian Desktop use on Pi3's, another option is now within reach, SMI based IDE drives.
Would IDE SSD's be the best solution? Same IDE drive or SATA or M2, in USB caddy?

I don't fully trust USB sticks, had lots over the years, some have failed, but then so have IDE drives.
Comparing to rotating PC IDE HD?
Well at least you can pull apart HD's and get useful stuff from them, I have lots of stuff :lol:
Drink coasters, mirrors, super magnets, 3 phase motors......

What were SD cards intended for, running OS's?
Are we pushing them to their limits?
I suspect some of us have bumped up against early failure modes and gone way past that.
I personally found it a weakness years ago, found solutions and learned a lot in the process.
I no longer regard it a weakness but an asset.

Re: SD cards - the Pi's greatest weakness

Posted: Thu Nov 30, 2017 9:57 am
by jamesh
If anyone has a solution to this almost non-existent problem, that costs a few cents to implement, I'd like to hear about it.

Or even if something even knows what the problem is in the first place, that would be interesting. Because without knowing what the problem is (if there is one) finding a solution is going to be difficult.

Meanwhile, almost everyone will keep getting on with sudo halt, or pulling the plug, with no ill effects whatsoever.

Re: SD cards - the Pi's greatest weakness

Posted: Thu Nov 30, 2017 10:19 am
by hippy
bensimmo wrote:
Wed Nov 29, 2017 2:18 pm
Stuff happens.
I guess that's fair enough.

When we use our PC's it's with the knowledge that the HDD or SSD may fail, we may lose everything on that, we will have to buy a replacement.

When using a Pi we should also recognise that SD Cards can and do fail, we may lose everything on that, we will have to buy a replacement.

In both cases, we can hope it doesn't happen too often, avoid doing things which may provoke a failure, and keep backups of our work. HDD, SSD and SD Card failures are a fact of life.

Re: SD cards - the Pi's greatest weakness

Posted: Thu Nov 30, 2017 8:25 pm
by Imperf3kt
jamesh wrote:
Thu Nov 30, 2017 9:57 am
If anyone has a solution to this almost non-existent problem, that costs a few cents to implement, I'd like to hear about it.

Or even if something even knows what the problem is in the first place, that would be interesting. Because without knowing what the problem is (if there is one) finding a solution is going to be difficult.

Meanwhile, almost everyone will keep getting on with sudo halt, or pulling the plug, with no ill effects whatsoever.
The non existent problem that people are describing, is that, seemingly at random and by following the correct shutdown procedures,, some people are still killing SD cards. Some even claim the cards are brand new or nearly unused.
I've experienced it myself - bought an SD card that was write protected out of the packet.

From what has been said, it sounds like an issue with the technology, not the Pi, but it is an issue. Just because its a rare occurence doesn't mean it doesn't exist.
Don't just sweep it under the rug to save face.

Re: SD cards - the Pi's greatest weakness

Posted: Fri Dec 01, 2017 2:18 am
by Gavinmc42
I don't want to go weird on everyone but I have noticed personal attitude seems to effect electronics.
If you believe things will fail they will, likewise if you think it will work, it does.
My theory, totally unproven, is thought patterns can effect the body and it's electric field and perhaps cause quantum effects.
This is evident in Krilain photos etc.

Some of you may know people who can just break things by coming near them or stop watches etc.
Is it static charge or something else? Some people just seem to carry a charge and can zap anything.
There is a warning on the camera sensor, static sensitive, I have used lots of them no problem.
I don't follow rigid, strict anti-static precautions, but that is because I know things work around me ;)
I even use my thumb to scrub the contacts on the microSD cards to clean them, which is just asking for static damage :lol:

Have you heard someone faced with new technology complaining "these things never work for me".
And you know others who have no problem with anything.

Quantum Computing will be interesting, some people could be banned.
"Don't let him near our Qubits, he is a quantum black hole"
Any sufficiently advanced technology is indistinguishable from magic.
A Clarke
I have walked into rooms where engineers have spent hours debugging, "it is not working", I say "yes it is", sure enough it works.
Electronics is magic for me :lol:
I worked in one company decades ago with an "anti magic" Director, for final testing we would give the product to him as he could break anything. If it survived it had passed the last test and was ready for market. :lol:

But you can still get crap stuff that fails first time, which is a known failure mode ;)

Re: SD cards - the Pi's greatest weakness

Posted: Fri Dec 01, 2017 5:35 am
by ejolson
jamesh wrote:
Tue Nov 28, 2017 5:14 pm
i486 wrote:
Tue Nov 28, 2017 1:34 pm
jamesh wrote:
Tue Nov 28, 2017 1:21 pm
Note, 17M sold so far, and the failure rate of SD cards, as seen on the forums, is not huge. So I suggest it is actually quite rare.
Compare these 17M sold Pi-s with the number of users of this forum. It is extremely clear that many SD failures are not reported here.
That doesn't follow. This is the largest Pi forum. If huge numbers of card's were failing, this forum would be inundated.
When a person buys a stereo headset at Poundland, do they complain when the sound is bad and after a month or two the headset breaks? Usually the person is relieved because they now have an excuse to spend on a proper headset. So may it be with computers.

Having said that, I've not had much trouble with sdcards in my Pi. One Samsung EVO card got corrupt by what I thought was a clean shutdown. However, that card was still writeable so I was able to reformat it and start over. Since then I attach an external USB drive to my Pi if I'm doing anything that requires much file input and output.

Since all flash memory wears out by design, it is a good idea in my opinion to make it replaceable. As many know, standards-conforming sdcards support flags in the firmware to temporarily and permanently write protect the card. While these flags can't be set from Windows using a USB sdcard reader, they can be set using the Raspberry Pi.

One could imagine a Pi virus that sets the write protect flag, but I've never heard of such a thing. Alternatively, random data written during low or loss of power might accidently set the flag. As already mentioned, the firmware in the sdcard itself could also set the write protect flag as a safety measure to prevent data loss.

Re: SD cards - the Pi's greatest weakness

Posted: Fri Dec 01, 2017 8:40 am
by jamesh
Imperf3kt wrote:
Thu Nov 30, 2017 8:25 pm
jamesh wrote:
Thu Nov 30, 2017 9:57 am
If anyone has a solution to this almost non-existent problem, that costs a few cents to implement, I'd like to hear about it.

Or even if something even knows what the problem is in the first place, that would be interesting. Because without knowing what the problem is (if there is one) finding a solution is going to be difficult.

Meanwhile, almost everyone will keep getting on with sudo halt, or pulling the plug, with no ill effects whatsoever.
The non existent problem that people are describing, is that, seemingly at random and by following the correct shutdown procedures,, some people are still killing SD cards. Some even claim the cards are brand new or nearly unused.
I've experienced it myself - bought an SD card that was write protected out of the packet.

From what has been said, it sounds like an issue with the technology, not the Pi, but it is an issue. Just because its a rare occurence doesn't mean it doesn't exist.
Don't just sweep it under the rug to save face.
I said ALMOST non existent. I not saying it's never happened.

Re: SD cards - the Pi's greatest weakness

Posted: Fri Dec 01, 2017 8:47 am
by DougieLawson
Gavinmc42 wrote:
Fri Dec 01, 2017 2:18 am
I don't want to go weird on everyone but I have noticed personal attitude seems to effect electronics.
If you believe things will fail they will, likewise if you think it will work, it does.
My theory, totally unproven, is thought patterns can effect the body and it's electric field and perhaps cause quantum effects.
This is evident in Krilain photos etc.
What a wonderful example of classic parapsychology.

If you believe that you probably believe Homeopathy is more than just a glass of tap water.

Re: SD cards - the Pi's greatest weakness

Posted: Fri Dec 01, 2017 9:17 am
by Heater
ejolson,
When a person buys a stereo headset at Poundland, do they complain when the sound is bad and after a month or two the headset breaks? Usually the person is relieved because they now have an excuse to spend on a proper headset. So may it be with computers.
I con't figure out where you are going with that.

None of my Pi kit comes from any poundland like store. It's all from reputable brands, bought in reputable stores. Hardly cheap, nothing is around here.

I do hope you are not suggesting the quality of the Raspberry Pi is anything like that of the junk you find in Poundland ?

Re: SD cards - the Pi's greatest weakness

Posted: Fri Dec 01, 2017 9:22 am
by Heater
Gavinmc42,
I don't want to go weird on everyone...
But then you just went right ahead an did so anyway.

As if the pink, fluffy, rainbow dancing, unicorn sheep like thing in your avatar was not weird enough :)

Re: SD cards - the Pi's greatest weakness

Posted: Fri Dec 01, 2017 10:29 am
by jamesh
And....I think that'll do before the flat earthers turn up.