Hello,
I’m running Openhab 3.3.0 on Openhabian and a Rasspberry Pi4 on SD-Card with activated ZRAM, rrjd as persistence service. Also I would like to use Amanda as well.
After the last blackout, I learned the hard way, that my setup is not resilient to it, loosing the persisted data since the last power-up (over 1 month in this case). This is the expected result as I figured out now.
So now I’m adding a UPS to the system to shutdown everything correctly.
But now I’m kind of lost. How to turn it off correctly?
I tried using sudo service openhab stop
but it seems that this does not secure that all data is correctly saved.
Here: ZRAM status it is said under “donts”, ZRAM needs to be shutdown properly, but not how to do so. They say to use Amanda to secure against blackouts.
I couldn’t find a “best practice” solution that was understandable for me.
How to shutdown the system correctly, saving all data and actually writing it to the filesystem?
I think Amanda then is “only” a way of a general backup strategy.
There’s no difference, as they both call the shutdown command.
sudo reboot = sudo shutdown -r
You would only lose data if power was lost before data was written from ZRAM (as happened with the power outage), which should not happen if you run shutdown or reboot.
Are you using Network UPS Tools? If so, the NUT monitoring client will shut down your RPi and there’s no need to run commands from openHAB.
@mstormi
Seems someone has seen your issue / feature request to zram-config on github.
with release 1.5.0 (May 2022) there is a “sync” option in zram-config and a predefined .timer and service to do it once a day.
just from testing it, it needs some time to execute and in this time, the UI of openghab 4 seems to be not properly reachable, but the persistence data is there and complete for the time in between.
this timer should be executed well before sdrawcopy.timer and sdrsync.timer / service… Maybe it makes even sense to not even execute that timer, but just exec what the timer would do.