I´ve been experiencing the sudden change in SD Cards installed in Raspberry PIs (3B+ mostly) that go read-only after a sudden loss of power.
As I have to install these devices far away, running a Python system (that writes files to the local storage), I am looking for a way to programatically a) detect if the SD filesystem goes read-only, and b) revert it back to read/write status. This should be done from a Python script or from a Bash script.
Is there any way do accomplish this?
Another way to go would be to install the Python system in a SD, set it as read-only, and also connect a small USB pendrive to the Raspberry to handle the file operations. So normal boot from SD, and file writing to the pendrive... but I´m trying to avoid the extra hardware if possible.
Any advice? Thanks in advance.