Some people seem to have a lot of problems with corruption whereas others do not, which is very puzzling. E.g., I got my first pi more than two years ago, I now have 4, and at least one has been on that whole time. While I usually shut them down properly, I do regularly end up having to kill the power, there have been occasional outages, and I sometimes use a battery that I just let run out.
One of my theories about this is that some small percentage of pis are defective and screwing up cards due to under/over voltage either when power is removed or cut. There have been a number of people here reporting peristent SD card corruption even with a read-only filesystem (#1 -- #2 -- pretty sure there is at least one more I cannot find). That means it is not due to the power being cut with the filesystem out of sync; in other words, shutting down properly would probably not prevent this.
But I have a new theory, after trying to compile a 3.18.x kernel with a cross-compiler I built some time ago. It used gcc 4.8.1, which was released in 2013. Apparently about 7 months ago (looking at the git commits on the kernel), a little bit was added to an ARM specific file in the source such that when I tried to compile it, I got this error:
Your compiler is too buggy; it is known to miscompile kernels
The file this comes from contains a note:
* GCC 4.8.0-4.8.2: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854
* miscompiles find_get_entry(), and can result in EXT3 and EXT4
* filesystem corruption (possibly other FS too).
^^^^^^^^^^^^^^^^^^^^^ LOOK
I never had any problems, but one thing I can pretty much guarantee is that for some number of months a lot of raspberry pi distro kernels were built using gcc 4.8.0 - 4.8.2.
I'm sure they are not anymore, so if you have not upgraded your kernel recently, do. You can check the date your kernel was compiled with uname -v
. If it was anytime before December 2014, this may be your problem.
RaspTV2:~ # cat /proc/version
Linux version 3.17.8 (stephan@buildserver.fritz.box) (gcc version 4.9.2 (GCC) ) #1 PREEMPT Mon Feb 9 00:14:40 CET 2015
– whitenoisedb May 12 '15 at 06:11fsck
manually. I'm trying to think solutions knowing that this may not be ever fixed... – whitenoisedb May 13 '15 at 01:12