Hi, i have more raspberry that are switched off electrically without halt or reboot. I can not do anything to resolve this situation, so i can only adapt. I use raspian and I have already had many failures.
- forcing with tune2fs to recheck /dev/root every reboot improve the problem mitigation?
- why raspian don't use a journaled FS? Journaled FS is better in this case?
Raspbian DOES use a journaled FS, but it is not enough to solve the problem of wear leveling because blocks are affected that were not involved in the most recent updates.
Also the journalling is only for the filesystem metadata and not for the userdata, so any files with internal structure that is invalid for some time during an update (e.g. an indexed file with index elsewhere in the same or another file) will not be consistent when the power drops during an update, even with the journalling on. A recheck of the filesystem does not find those problems, there should be a repair specific for the application that maintains that file.
The "problem" at hand appears to be in that area, as my experience with Raspberry Pi running a plain command mode interface and not much activity on the FS is that it does not matter when the power is cycled unexpectedly.
The only complete solution would be a power-supply holdup circuit with a supercap big enough for the shutdown period, but there probably are ways to mitigate the problem without that. So no easy answer, but there was a post on the Raspberry Pi forums saying that you can offload the filesystem onto a USB stick, turning the SD card into a read-only device, and that USB sticks tend to be better at handling power loss. Seems a bit complex:
Some time ago I prepared a minimal boot SD card, and transferred my RASPBX system to an 8 GB USB stick, it worked well, but I came to the conclusion I was deluding myself that it would be any more immune to file corruption that way.
On the basis of your comments I have refreshed the thumb-drive image, (and created a second one as back up), and returned to this dual medium solution.
It has a uusb in and a usb out. Just connect the battery in series with the pi psu and the pi, and it works as a UPS. Probably a good idea to replace it annually, or at least test it, before the LIPO dies.
Raspbmc's installer has the option to install to a USB stick - is this what you did? I think I may try it in view of a statement in the above forum thread that overclocking core_freq corrupts SD cards but not USB sticks.
No, I migrated an existing system to the thumb drive. I created an image of the SD card with Win32DiskImager on a Windows laptop and wrote the image onto the thumb drive. Then I edited cmdline.txt on the SD card. This file is in a FAT32 partition so it appears as the root under Windows
originally (boot from SD run applications from SD)
Modified to (boot from SD run applications from USB)
My application, an IP PABX performs exceedingly well without over clocking, so I have never tried.
If you choose a model that's resistant to power failure, then yes, but the same caveat applies to SD cards. We're using Transcend SD cards (4G and 8G) and aren't seeing power related faliures any more.
loose-card related failures are another matter, but B+ should help that.