Data loss in rrd4j database after reboot


I’m running openHAB 2.5.6-2 on my rasberry pi 2 B. Some Items are stored using rrd4j persistance and data history is displayed in a chart on my sitemap. This works pretty well.

Strategies {
everyMinute : “0 * * * * ?”
everyHour : “0 0 * * * ?”
everyDay : “0 0 0 * * ?”
default = everyChange

// ******** Node 0 *******
humid_N00 : strategy = everyMinute, restoreOnStartup
tempe_N00 : strategy = everyMinute, restoreOnStartup

My Problem is that everytime I reboot the system all the charts are empty - so the data seems to be lost. After that new data will be stored again according to the code in the rrd4j.persist file. The chart will be updated with the new data accordingly.

Some people on the forum seem to have similar issues - but honestly I didn’t get the solution which fits for me reading their posts.

Maybe someone has a helping hint ….

thanks in advance


Is ZRAM activated? Just an idea…
How do you reboot your Raspi?

Do you specify rrd4j as the persistence service in your chart-line?

To distinguish persistence issue from charting issue, use REST API to inspect available data for a sample Item, see if goes back before last reboot.

Does have the feel of not writing ZRAM to permanent file. Permissions?


seems that all of you are on the track - and maybe there is more than one thing I didn’t care about so far!

As I understand from ZRAM is enabled per default meanwhile. Would you recommend trying to deinstall it?

I’m rebooting the system by sending a ‘sudo reboot’ to the pi via putty. Pretty brutal…?

To show you some of the other code I used for storing the data:

A comma-separated list of persistence services to install (e.g. “persistence = rrd4j,jpa”)
persistence = rrd4j

################ PERSISTENCE ####################
The persistence service to use if no other is specified.

Switch item=Chart1Period mappings=[0=“Stunde”, 1=“Tag”, 2=“Woche”, 3=“Monat”, 4=“Jahr”]

    Chart item=gSchlafzimmer period=h refresh=600 visibility[Chart1Period==0, Chart1Period=="Uninitialized"]
    Chart item=gRoom01 period=D refresh=6000 visibility=[Chart1Period==1]
    Chart item=gRoom01 perinotod=W refresh=6000 visibility=[Chart1Period==2]
    Chart item=gRoom01 period=M refresh=6000 visibility=[Chart1Period==3]
    Chart item=gRoom01 period=Y refresh=6000 visibility=[Chart1Period==4]

I’ve not used REST API so far so I will need some time to get into it. But my understanding at the moment is that charting itsself is working fine and the issue is with the data. I belive this cause after a reboot the chart will suddenly be without any data line but a minute later (strategy = everyMinute !) it is starting to build up a new line based on the next data coming in.

Ok and permissions of the data log files:
-rw-rw-r-- 1 openhab openhab 28280 Jul 25 23:44 humid_N00.rrd
-rw-rw-r-- 1 openhab openhab 28280 Jul 25 23:44 tempe_N00.rrd

hope this makes clearer what I’m doing here

Hi Rick, how did you solve your problem? I have the same issue.

I have the same issue after a “sudo reboot”.
Zram is activated.
Reboot took also very long, over 10min.

If you working with OH3 and openhabian try a disable and subsequently enable zram.

Yes OH3. I have deactivated the Zram for persistence in the /etc/ztab config and the data was stored after reboot. Afterwards I have activated it again and data between was lost again. So definitely something wrong with the reboot and Zram persistence.
I will keep deactivated but maybe somebody knows how to solve that issue.
I had a fresh installation and no migration.

Why you didn’t take the openhabian-config menu ?

+1 for me: RRD4j data loss after rebooting my Raspberry. Removed ZRAM now and now the perstisted data survive the reboot.

Because I wanted to have Zram enabled for log files

@mstormi maybe you can help for this topic?

Please don’t ping people. Most users feel annoyed by that and so do I.

Current ZRAM code works and is reboot safe. There have been issues lately though so if you have problems on your system first thing is to ensure you run the latest code.
Uninstall and reinstall ZRAM from the menu.

1 Like

Good to know.

I uninstalled and reinstalled from the menu and now it works. I updated everything before but I missed to reinstall again.
Thanks for the hint

I have the same issue. Pi 4 with OpenHabian, OH2.5 still, but the same, losing all RRD4J data. I tried to enable/disable ZRAM via the openhabian-config, but i get the following error:


OK, maybe the config tool error is nothing… after i tried a couple of times to enable ZRAM, but got the above error, i rebooted the Pi to see if that helped. Much to my delight, the rrd4j data was saved… so i guess it changed something, even though it gave the error!

I’ve been able to have the rrd4j data persist throughout reboots, but a power failure still resulted in data loss. Now I just moved persistence away from ZRAM entirely.

I had the exact same issue and uninstall ZRAM and enable it again via openhabian config worked for me. (raspi 4 and openHAB3)

Which will increase likelihood of a system crash by some fair n00 percent.
As stated above multiple times, uninstall + reinstall ZRAM.

How many times? Because once is obviously not enough.
I did read this topic, and did reinstall ZRAM already. I was happy to get from a place, where persistence was not persisted at all, to where it could survive a programmatic reboot. Then the power outage happened and I lost the persistence records again.
I am aware this will increase the wear on my SD card. I’m thinking of switching to a cloud based
(DynamoDB most likely) persistence to avoid that.