Page 2 of 4
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 8:24 am
by fanoush
BTW recently I got the
64GB flash based PiDrive from western digital and it was a bad idea. I expected WD selected some good flash drive with good random I/O (as they even tuned the HDD based Pi drives to use less power for the Pi) but they did not. They are shipping SanDisk Cruzer Fit SDCZ33-064G-B35 which has very poor benchmarks. There is also poor quality review
https://www.raspberrypi.org/magpi/wd-pi ... sh-review/ which does not mention writing speed at all! After receiving it I run some benchmark for testing SSDs and the 4k random writes test almost killed it. The number quickly went down to 100KB/s and below. After stopping the benchmark prematurely (as it took ages and the speed number went down and down) the flash drive remained almost unusable. Any copy of big file to it with windows explorer very soon slowed down to 0KB/s. Even reformatting didn't help. The drive also doesn't support ATA secure erase which is often used to recover poor writing speed. What helped is overwriting sequentially via dd with zeroes. There were specific sections on drive that were much slower to rewrite with zeroes than other (possibly locations stressed by benchmark) but it got better when repeating it. So now it is again ordinary flash drive for storing data but definitely not something suitable for using as root fielsystem on the Pi.
So just wanted to warn you. The HDD based Pi drives are good but the flash based one is not. Probably idea of some marketing person after WD-Sandisk merge. Also the MagPi review did not help as it did not went to such 'depths' as mentioning write speed importance (and also random vs sequential I/O difference).
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 8:40 am
by Imperf3kt
I am very rough with my SD cards and uSD cards.
I've got dozens (because they were cheaper, faster and more versatile than other forms of storage over the years)
Some have been used in dashcams on constant read/write/overwrite cycles for several years.
I have been forced to pull the power on the Pi several times due to freezing and crashes. A little bit of common sense says wait for the green light to stop flashing and then wait some more before pulling the power.
I carry them around, unprotected, in my pockets or in my car center console (where the temperature often exceeds 60℃ or more)
I am yet to have a single card die or corrupt.
How do some people manage to break theirs?
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 8:52 am
by fanoush
Imperf3kt wrote: ↑Tue Nov 28, 2017 8:40 am
A little bit of common sense says wait for the green light to stop flashing and then wait some more before pulling the power.
.....
How do some people manage to break theirs?
I killed two cards by powering off when the green light did not stop flashing and Pi was not responding to anything for tens of minutes (swapping hell). How would typical user solve that?
Both cards are now read only - i.e. they accept writing without errors but after reboot of later after reading you see the data were not really written at all.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 8:55 am
by Heater
Imperf3kt,
How do some people manage to break theirs?
I just look at them and they stop working.
In the early Pi days I ended up with a bunch of SD cards that had become write protected. In whole or in part.
For example. I could use dd to write all 0x00 or all 0xff to them and then find that there were blocks here and there that did not take the write.
Then there was the one that got really hot and started smoking whilst I was looking at it !
Oddly enough in recent years I have not had any failures. No matter how hard I look at them

Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 9:42 am
by i486
It is interesting whether Orange Pi has the same problems with SD cards.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 10:05 am
by DougieLawson
i486 wrote: ↑Tue Nov 28, 2017 9:42 am
It is interesting whether Orange Pi has the same problems with SD cards.
No it isn't. We don't care how those SBCs work or not.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 10:14 am
by RaTTuS
i486 wrote: ↑Tue Nov 28, 2017 9:42 am
It is interesting whether Orange Pi has the same problems with SD cards.
not really , they probably have much less test data, and you mainly hear about he bad ones here .....
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 10:17 am
by HawaiianPi
fanoush wrote: ↑Tue Nov 28, 2017 8:52 am
I killed two cards by powering off when the green light did not stop flashing and Pi was not responding to anything for tens of minutes (swapping hell). How would typical user solve that?
With the magic SysRq keys. Hold down Alt and SysRq/PrtSc at the same time, then press and release the following keys in sequence, pausing a few seconds between keys.
r e i s u b
How do you remember this? Use the mnemonic
Reboot
Even
If
System
Utterly
Broken.
This will force Linux to do a safe reboot. To shut down instead, substitute "o" (as in off) for the "b" (boot).
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 10:35 am
by cpc464
I have never had an SD card break, even the older big ones. I run 4 Pis at home, 2 of them 24x7, as well as a sheevaplug which also uses an SD card (sheevaplug is similar to Pi, uses big old SD cards). The sheevaplug has been online for 7 years, 24x7, constantly reading and writing to the card, with never a problem.
All I can say is that if ever a Pi is powered off without being cleanly shut down, I remove the SD card, put it into my Linux laptop and do an fsck to repair any file system errors. Usually the only "error" is the dirty shutdown flag being set, which the fsck clears. These are file system (ie. software) errors, rather than hardware. I have not experienced any hardware (ie. electrical) error on an SD card.
If ever a Pi shuts down uncleanly, the SD card should always be removed, checked and repaired on another Linux system - always, without fail. Even a small file system error, if left unrepaired, can multiply over time until the file system is destroyed.
Sorry for the lecture, and I am sure you know the above already, it is just wierd that Pi users have been complaining about broken SD cards from day 1 and I have never experienced it, despite hammering my Pis 24x7 for several years. I am not sure what people are doing to their Pis out thare.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 10:40 am
by i486
DougieLawson wrote: ↑Tue Nov 28, 2017 10:05 am
i486 wrote: ↑Tue Nov 28, 2017 9:42 am
It is interesting whether Orange Pi has the same problems with SD cards.
No it isn't. We don't care how those SBCs work or not.
Do you imagine that something can be wrong in Raspberry Pi? Or you think it is absolute perfection? Orange Pi is cheap imitation but if a little difference makes SD card work more stable, this can be used to improve Raspberry Pi (4). Don't be fanatic.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 10:43 am
by Heater
cpc464,
I am not sure what people are doing to their Pis out thare.
That is the point. We don't know what is going on. There is a constant trickle of people turning up here who can't format their SD cards because they have become write protected. This is not just file system corruption caused by random power loss, that can be easily fixed.
So far we have no idea why this happens. If we trust the reports coming in then it's not due to wearing them out by writing too much, often it is claimed that it is fairly new cards that have failed.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 11:03 am
by cpc464
I think that the "Pi's greatest weakness" is the lack of a power switch that, when pressed, performs a clean shut down, like a PC. The first thing that many new users will do, especially children perhaps, is to unknowingly corrupt their own file system. And they won't always have a nearby Linux system to fix it, especially when the Pi is in a remote location, for example.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 11:37 am
by jahboater
If the dirty shutdown flag is set, the system should run fsck on the next boot.
It should not accumulate errors.
I suspect the difference is that people don't think of these cheap SBC's in the same way that they think of their PC, and they don't treat the SD card with the same care they would treat the hard disk in their PC.
For me, I have found the SD cards to be reliable.
But, I take basic steps to reduce unnecessary writes to the card, always shutdown very carefully, and buy quality genuine cards (mostly Samsung EVO Plus).
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 11:47 am
by fanoush
Heater wrote: ↑Tue Nov 28, 2017 10:43 am
That is the point. We don't know what is going on. There is a constant trickle of people turning up here who can't format their SD cards because they have become write protected. This is not just file system corruption caused by random power loss, that can be easily fixed.
But this is not specific to the Pi. I've see same problem for years anywhere where sd cards are used like this. They are simply not designed for this. Search e.g. xda-developers, same issues when booting android from card. It is more here just because community is larger and booting from sd card is primary way to use Pi.
The reason is clear - poor recovery of SD card controller firmware when power is cut - bug or feature. And then when it detects some uncorrectable inconsistency it simply gives up and keeps it read only so people could at least copy stuff over and then throw it out.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 11:49 am
by hippy
Imperf3kt wrote: ↑Tue Nov 28, 2017 8:40 am
How do some people manage to break theirs?
That is the real mystery and there has so far been no definitive answer. If people are simply pulling the power they can expect problems even if many people do seem to get away with doing that. But some having problems do seem to be doing everything right, using decent quality cards, cleanly shutting down the OS and waiting before pulling the power, so it's not at all clear what the issue is or its cause.
i486 wrote: ↑Tue Nov 28, 2017 10:40 am
Do you imagine that something can be wrong in Raspberry Pi?
It could be but it is not wise to indulge in concern trolling that there may be something wrong with the Pi. There are a number of potential explanations for what the cause could be, but, given there is no evidence to support those at present, it would merely be speculation.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 11:54 am
by jahboater
fanoush wrote: ↑Tue Nov 28, 2017 11:47 am
The reason is clear - poor recovery of SD card controller firmware when power is cut - bug or feature. And then when it detects some uncorrectable inconsistency it simply gives up and keeps it read only so people could at least copy stuff over and then throw it out.
Then wait for a bit between OS shutdown and subsequent power off.
I do:-
sync // out of habit
sudo poweroff
wait for a couple of minutes after the green light stops
cut the power
... never a problem.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 11:55 am
by fanoush
HawaiianPi wrote: ↑Tue Nov 28, 2017 10:17 am
fanoush wrote: ↑Tue Nov 28, 2017 8:52 am
I killed two cards by powering off when the green light did not stop flashing and Pi was not responding to anything for tens of minutes (swapping hell). How would typical user solve that?
With the magic SysRq keys. Hold down Alt and SysRq/PrtSc at the same time, then press and release the following keys in sequence, pausing a few seconds between keys.
r e i s u b
How do you remember this? Use the mnemonic
Reboot
Even
If
System
Utterly
Broken.
This will force Linux to do a safe reboot. To shut down instead, substitute "o" (as in off) for the "b" (boot).
Good point. If USB interface still works, which sometimes does not in such case. Also there are reset pin holes on the board to shortcut, most probably this is better (than pulling power plug) as it stops the flow of commands to card without power being completely cut. Both solutions are not what would typical user do.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 12:40 pm
by cpc464
A second weakness of the Pi, perhaps, is it's inability to switch itself off in response to shutdown -h or similar. Users therefore have to guess when the system is truly down by watching the green light etc. But nobody can be abolutely sure that the system is down. Rarely, it could be up still, in some loop, accessing the card.
However, in another sense, at £30 I don't really think the Pi has any weaknesses at all.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 12:46 pm
by cpc464
jahboater wrote: ↑Tue Nov 28, 2017 11:37 am
If the dirty shutdown flag is set, the system should run fsck on the next boot.
Yes I know. Nontheless, I still remove the card, put it into a Linux PC, and do an fsck there. I do 2 fscks, the second one just to verify that there are no errors. Then I put the card back into the Pi.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 1:07 pm
by i486
Heater wrote: ↑Tue Nov 28, 2017 10:43 am
cpc464,
I am not sure what people are doing to their Pis out thare.
That is the point. We don't know what is going on. There is a constant trickle of people turning up here who can't format their SD cards because they have become write protected. This is not just file system corruption caused by random power loss, that can be easily fixed.
So far we have no idea why this happens. If we trust the reports coming in then it's not due to wearing them out by writing too much, often it is claimed that it is fairly new cards that have failed.
I have not broken SD card with my Pi (btw it is 1B+, not Pi3). But have seen too many broken SD cards (write protected/"can't format" syndrome). For that reason I believe that SD problems are not from incompetent Pi users. The problem is mostly in SD firmware (I guess) and Pi has bad luck to hit the SD issue. However, millions of digital cameras are using SD cards without such problems which means that they don't do the "wrong step" of Pi.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 1:21 pm
by jamesh
i486 wrote: ↑Tue Nov 28, 2017 1:07 pm
Heater wrote: ↑Tue Nov 28, 2017 10:43 am
cpc464,
I am not sure what people are doing to their Pis out thare.
That is the point. We don't know what is going on. There is a constant trickle of people turning up here who can't format their SD cards because they have become write protected. This is not just file system corruption caused by random power loss, that can be easily fixed.
So far we have no idea why this happens. If we trust the reports coming in then it's not due to wearing them out by writing too much, often it is claimed that it is fairly new cards that have failed.
I have not broken SD card with my Pi (btw it is 1B+, not Pi3). But have seen too many broken SD cards (write protected/"can't format" syndrome). For that reason I believe that SD problems are not from incompetent Pi users. The problem is mostly in SD firmware (I guess) and Pi has bad luck to hit the SD issue. However, millions of digital cameras are using SD cards without such problems which means that they don't do the "wrong step" of Pi.
Camera shutdown procedures ensure power to the card until it ready to shutdown. So not a good comparison.
I've never seen this write only issue with SD cards, could be SD card firmware.
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.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 1:34 pm
by i486
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.
One simple reason for SD issue can be weared area (probably around FAT blocks) which causes read-only condition instead of marking weared area and replacing it with other flash.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 1:59 pm
by RaTTuS
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.
One simple reason for SD issue can be weared area (probably around FAT blocks) which causes read-only condition instead of marking weared area and replacing it with other flash.
no you fail to understand how sdcards work, all 'sectors' are all over the place,
writing to one location will 'eventually' cause the whole device to be written to ,
badly programmed sdcotrollers [on the flash itself] can cause issues
if there was a problem then there would me a massive rush to this forum to protest,
I'm not saying the maybe a problem but we have far too little info to go on
one person saying it fails a lot is not indicative of a general problem
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 2:18 pm
by fanoush
jamesh wrote: ↑Tue Nov 28, 2017 1:21 pm
I've never seen this write only issue with SD cards, could be SD card firmware.
I can send you such card if you are curious, just PM me. I was amazed too when it happened fist time. It all works, reading, writing, you can overwrite card via dd with zeroes and it will happily do it for you without reporting any error. But all those writes go nowhere. When you read it back you get old data.
As for latent bug causing this, I've seen similar 'bug' on Maemo devices, the bug report with explanation can be read here
https://bugs.maemo.org/show_bug.cgi?id=1204#c120 - basically SDHC cards reported that data were written but it was not true and when power management turned card off too early after that it became corrupted. I don't think this is the case with Pi as the power management is not so aggressive.
Re: SD cards - the Pi's greatest weakness
Posted: Tue Nov 28, 2017 2:36 pm
by i486
fanoush wrote: ↑Tue Nov 28, 2017 2:18 pm
It all works, reading, writing, you can overwrite card via dd with zeroes and it will happily do it for you without reporting any error. But all those writes go nowhere. When you read it back you get old data.
In this "mode" the SD card reports write-protect error on block writes (tested). But it seems it is ignored at least by Windows7 SD/MSD driver. The cache returns new values and writes seem normal. If writes are more than the capacity of cache, Windows hangs trying to finish SD write (probably infinite retries). When you remove the card and re-insert it you will see the old contents. There is "temporary write-protected" flag in CSD and Windows uses it to understand that card is read only. But this flag is 0 and probably for that reason Windows doesn't expect that write block can fail with write-protected error.
The problem is not in Raspberry but in SD cards. But if it can be bypassed (probably with Raspbian patch) will be very good. There is a little chance to need hardware modification. I am not expert in hardware and cannot say what change.