ZRAM Issues on Pi4

Platform information:
Raspberry PI 4
Openhabian
Java Runtime Environment:
openjdk version “17.0.7” 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 17.0.7+7-Debian-1deb11u1, mixed mode, sharing)
openHAB version:V4

Issue of the topic:
The graph below confirmed an issue which i have observed but failed to solve. Initially i thought the issue was a charting issue where some data disappears causing gaps on the info. However 2 weeks ago, after reading zram issues, i realised that possibly zram was causing issues which resulted in the data going missing. Typically this happens when the device restarts unexpectedly. I uninstalled Zram rebooted and the reinstalled ZRAM. For a few days all seemed fine with data being kept as expected through reboots. The problem showed up again this week. What is strange is that some data is stays and is removed. Today i woke up to find my OH failed a few automations. It was painfully slow. I rebooted. at 8am. Then it came alive. Upon checking the logs, all entries for the last week until at 5am today are missing. Various graphs are also missing data for some days.

My question is, Is this ZRAM issue or memory card issue or even the installation itself?

Not a Zram expert, but you need to find out what is causing this. All Zram data is lost on a sudden restart/reboot. (It is a feature, not a flaw :wink:)

Same here.

Forgive me on my ignorance but this has been working flawlessly without losing data before. While it is possible to lose data on unexpected reboot, I don’t expect to lose data when I restart the device myself. That is graceful restart data should be preserved.

Maybe not the solution you like to hear, but replace sd card by an SSD and disable zram.

Iam not sure which solution exactly you are referring to. I understood that sudden reboot, I am likely to lose data. Iam ok with that. Losing data on graceful restart, is not ok. Iam not convinced that the authors intentionally chose that as it defeats the purpose of keeping the system running. I will have to do some reading before i can agree with you.

Is SSD an option? I was just reading another discussion where SSD was being discouraged.

I was using an SSD from the moment where raspberry was officially announcing SSDs as a boot media (about 3 years ago).
I never had any problems at all.

It is all a matter of time. (how quickly (maybe 500MB?) can be written back to the SD card.
What does reboot mean to you?
reboot: No time, no data
systemctl restart openhab : maybe, not my area
shutdown -r : again maybe, but there is usually only about 1 minute

What is discouraged (IIRC) is the boot from SSD in openhabian. But transferring root to an SSD is an openhabian menu option (again IIRC)

Thank you. I read your previous discussion where some vocal members seemed not to approve SSD, hence my previous response. I will look into this.

thanks. reboot means telling the OS to reboot. I did not try to understand how much changes zram will keep before writing back to disk but for me regardless. The expectation is the same. When i issue a command to reboot, i believe all apps gets the notice to restart and start commtting to disk and and shutdown.
The only time i expect to lose data is when i use the force argument during the reboot.

Yes, I remember😀.
As to my personal perception, (and I am not stating that it is a fact) there are many posts regarding problems with zram, and none about problems using an SSD without zram. That was reason enough for me, to setup my system with an SSD only.

:rofl:That ZRAM portion is what prompted me to start looking at SSD. Before you mentioned SSD, i had written the idea off but iam thinking that i need to move to SSD.