[Beremiz-devel] Beremiz on Raspberry Pi with overlayfs

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Beremiz-devel] Beremiz on Raspberry Pi with overlayfs

Daniel Mirkin

Dear Beremiz developers:

First of all, Happy New Year!

I'm trying to use an old Raspberry Pi 1 model B as a Modbus PLC with integrated IDE, using Beremiz runtime and Beremiz IDE (accesible from another PC via SSH -Y ...).

Since Raspberry Pi OS now supports overlayfs (available through raspi-config), I will try to install the OS and Beremiz in the overlayfs lower layer configured as a read-only filesystem.

Overlayfs lower layer can be switched to a read-write fs, using overctl script [1] or calling /usr/bin/raspi-config, to update/upgrade the OS, programs and its dependencies; and fundamentally, to generate the executable binary and save the PLC code; and then to switch again to a read-only system.

I will try to run Beremiz_service.py as a standalone service into a working directory in the upper layer (a read-write fileystem that includes overlayfs workdir), because I supose that the standalone service must write into variables when executing the user program (binary executable).

So, an unexpected powerdown probably will not corrupt the RPi OS nor the Beremiz IDE and its dependencies, and an eventual failure can be remediated by restarting the entire system and then launching again Beremiz_service.py.

I'm concerned about retained (persistent) variables. I have read (now I can not remember where) that retained variables are saved in a binary file. I supose that file is stored in standalone Beremiz service directory. But that directory will be a read-write filesystem, so a power failure probably will corrupt the binary file and its retained data if Beremiz service is writing it at this precise moment.

Is it posible to make a regular (via systemd timers or cron based) backup of this binary file onto another independent partition, and overwrite the original binary file with the last saved backup, previously to launch Beremiz_service.py?

Your advices and suggestions will be welcome!

Best regards,


[1] https://github.com/ghollingworth/overlayfs

Usage: overctl [-h|-r|-s|-t|-w]
           -h, --help       This message
           -r, --ro            Set read-only root with overlay fs
           -s, --status    Show current state
           -t, --toggle    Toggle between -r and -w
           -w, --rw        Set read-write root

Beremiz-devel mailing list
[hidden email]