ZRAM manual sync

Hi @mstormi
I have installed ZRAM since a year but I happened to suffer from some persistence data loss due to unmanaged reboots.
I have tried to setup Amanda, but for some reasons it didn’t work for me.

So I wanted to understand if it would be possible to manually sync the persistence files.

Looking into the folders, I discovered that the current files (stored in RAM) are in

/srv/openhab-userdata/persistence/mapdb
/srv/openhab-userdata/persistence/rrd4j

And the files stored in the SD card are in:

/opt/zram/persistence.bind/mapdb
/opt/zram/persistence.bind/rrd4j

So, do you think it will work if I create a cron job that copies the current files to the zram/persistence.bind folder, or will I mess up something?

cp /srv/openhab-userdata/persistence/mapdb/* /opt/zram/persistence.bind/mapdb/
cp /srv/openhab-userdata/persistence/rrd4j/* /opt/zram/persistence.bind/rrd4j/

You’re likely to mess up things. If it had been that easy we would have already built it in.
I suggest to get your backup setup right.

Hi Markus,
in my opinion a backup should be restored only when a catasrophic failure occurs.
An unexpected reboot is not a failure, is just part of normal life. Every system auto heals itself after an unexpected reboot.
Also because restoring a backup is a time consuming operation.

So a way to periodically synchronize the persistence database is really important to avoid unpleasant data loss.

That’s why I was trying to manually synchronize the files.

Just to understand, who is working on solving this synch bug? Is there any chance I could help testing the work in progress?

thanks

Noone, actually. It’s not a bug, it just is not implemented.

There now is an experimental sync implementation available you might want to test.
Note syncing requires to shutdown OH.

@ndye could you maybe explain how to install it best ?

1 Like

RTFM, but in summary just follow the manual to install the zram-config sync option. Make sure you use the builtin install script, not openhabian-config because as of yet the sync option is not built into openhabian.

NOTE: This means that this is currently not a supported change to openHABian so if things go wrong please raise a zram-config issue not openhabian.