4

I know there are a few debates about SD card corruption, but nothing is good enough for me.

In the beginning there was no problem with the SD cards, but lately it happened a lot after power failure.

Is there any way to reduce that? What exactly is the cause of that problem? Is there any data to check, what destroys the SD card? It is interesting, because a lot of things are OK, but there is no way to read /home/ or /var/, and the /etc/ssh directory is empty.

There is a python application that receives a lot of messages. Maybe less logging to the FS from the application? In the beginning there was less of the logging.

One possible solution is a UPS, but problem is, that it is sometimes necessary to unplug the power to restart device.

Is there a device, that can signal the Raspberry Pi to gracefully shutdown?

Jacobm001
  • 11,904
  • 7
  • 47
  • 58
Ashko
  • 141
  • 2

3 Answers3

3

In my experience, the only major corruptions I've had is from power problems. The best solution is to use a UPS. If you need to turn off the device, you should be issuing the command sudo shutdown now -h before you unplug it.

A standard UPS should run something as small as the RPi for a significant length of time. Long enough that I doubt a signal mechanism would be necessary. If you want something like that though, a popular hat tailor made for the RPi exists.

Jacobm001
  • 11,904
  • 7
  • 47
  • 58
2

Any raspberry pi users would have faced this problem at-least once in a while. And after such situation I had to reinstall rasbian loosing all my previous setups, scripts etc. Then i started using some tools like testdisk to recover files on the sd card. But still i had to reinstall the os. But sometimes using fsck you don’t need to reinstall the os again(i love both these tools). May be this might be usefull for some people (https://raymii.org/s/blog/Broken_Corrupted_Raspberry_Pi_SD_Card.html)

My present Pi setup is as follows: I use a mi 10400mah powerbank to power up my pi. Since this powerbank can be charged and be used at the same time i chose this one in particular. Later, I hooked an IR receiver to the GPIO and programmed a remote that was lying around doing nothing. With the help of LIRC i was able to identify the remote control's individual buttons. Then i wrote some shell scripts on the pi like shutdown, reboot, kill something etc and linked each scripts to each buttons(its just a configuration file that can be edited). So when there is a power problem at the mains, my powerbank will be backing up. And mean while i will shutdown my pi using the IR remote control.

Just a thought: I had another idea while i was working with IR remote, but haven’t got much time to play around, may be you can implement it if you can(if it doesn’t sounds bad).

Build a sensor that detects current flow(something like how an ammeter works) and connect it to the wire from mains to the powerbank. If ther is a power shutdown at the mains, then using an arduino or the very same pi sensing it to shutdown(Just a thought... ).

arvindh
  • 161
  • 1
  • 6
0

Have a look at Nard SDK if you need a robust system. It uses the SD-card only during boot. When startup has finished you can remove the SD-card at it will continue to operate just fine.
http://www.arbetsmyra.dyndns.org/nard/

Ronny Nilsson
  • 878
  • 5
  • 13