ottsm:
I'm keeping track of the temperature of over 30 beehives. The Yun is mounted out in a field and the power is sometimes unreliable. It writes the temperature data to an RRD file and a CSV file. If the power comes and goes it will basically need to be checked from time to time just to validate that the system recovered after power was restored.
The need is that when the power comes back on the program is able to restart. Currently it does not reliably run because the files that the program is trying to access have been locked out by the operating system. Even logging in as admin and trying to manually delete the files wont work. The only thing that I found that will work is to send a reboot command. The script running in the arduino code needs to have access again to the files that it was writing at before the power went off.
I know that data during the power outage was lost forever. But If I don't keep checking the system from time to time I could have lost data for a week even though the power may have been off for only a minute.
I suppose one way to solve the problem is to install a battery backup for the system. But I would have thought during a power up everything would be recover without sending another reboot to restart the system.
@ottsm,
you are trying to build a fault tolerant system. Your previous description and this one makes me believe that you think that "fault proof" and "fault tolerant" are one and the same.
"fault proof" is not possible - as you already know.
"fault tolerant" has levels of tolerance.
Wikipedia
Fault-tolerant computer systems are systems designed around the concepts of fault tolerance. In essence, they must be able to continue working to a level of satisfaction in the presence of faults.
As for the file system, your best options are solar panels with Capacitive power source. You will need about 6-8 seconds to shutdown the system. You will also need a watchdog to have the system shutdown. And for good measure you will need a Journaling file system.
The locked file you are encountering is from the "dirty" shutdown. The persistent media (SD) holds the file handle state. When you reboot from a "dirty" shutdown, the system the reads the "stale" state. Then when you do a "clean" shutdown, the OS closes the file - even if you have left it open.
The Journaling system will help with this, but unless you reset the parameters to the file system, you could lose the entire dataset - and likely several days work. There are many software work arounds - such as closing the file (or creating separate files) on a periodic basis (hourly, daily, weekly, etc.)
Okay. Beyond the loss of data, when the power is off, what other situations are tolerable?
Jesse