Data loss after uncontrolled reboot for several days

You can also change hardware platform to some mini PC. With SSD drive it will be a bit more resistant to unexpected shutdowns than PI with SD card and zram.

sadly i have the exactly same problem only with RRD4J (MapDB ,my default percistance, works just fine) and unexpected power loss.All my charts with power and gas consumption,freezers temperatures and others are gone after 5 hours of power loss last night.I have a ups but can last for 3-4 hours.I dont remember having this with openhab 3.xx.I have set to take monthly backups automatic but in that case i lose a full month of my charts.Is there a solution?Will a fresh openhabian install fix that?

Of course. The official docs recommend to setup Amanda, and if you had done that, it would have taken daily backups for you.

A fresh openhabian should do a daily sync of the rrd4j data in ZRAM to SD.
If yours didn’t you could add a cron job to do zram-config sync at intervals.

1 Like

As you now learned the hard way, it would be better to have a ups.
As it’s a Raspberry Pi, there are pretty cheap HATs for that purpose, they do only provide +5 Volt and the “better” models will provide even a watchdog and an rtc.
With the correct setup, when power is lost, the Raspberry Pi will shutdown and save all data.
When power comes back, the Pi will automatically start again and there will be no data loss at all.

scnr; :wink:

2 Likes

As the thread starter I can only recommend not to use a Rasperry Pi or specific hardware for openHAB, better use a virtual machine. I am using Proxmox on a Mini PC (HP Prodesk) with UPS and since then I have no problems at all: Easy backup, easy migration, snapshots before openHAB upgrades.
Amanda is a very complicated backup method compared to that.

1 Like

thx i just ordered one Hat ups with autoshutdown.I also take a conf backup daily to my nas using rsync.

Yepp, love ZFS :sparkling_heart: and zfs-auto-snapshot.