Openhabian SD mirroring: basic misunderstanding


I have recently been experimenting with the SD mirroring (option 53) in openhabian. Running on Rpi. I struggled to get it to work but, that was because of some basic beginners misunderstandings during the testing.
I thought it would be good to share them here, in case it might help someone in the future.

  • Consecutive tests with the same card.
    When testing, I switched the SD card in the USB card reader (card B) into the internal SD card reader (where originally card A was) to check the results. Right after finishing option 53 let s say. That worked. But then I let the automated sync run for a few days and checked again. It never worked. But I found what I was doing wrong. I had always put card B again as the external card. Just like that.
    I assumed that with the Rpi running on card A again, everything is still ok to sync towards B. But my understanding now is that as soon as a card has been used internally, even just for a few minutes, before it can be used again as external mirror, it must be formatted again, and (or) option 53 must be rerun.

  • The openhab logs (events and openhab.log)
    To check the daily syncs, I thought a good test dataset were the log files. They have constant updates, and they are files just like another. But now that I have the full SD mirror working, it is my finding that the log files seem to be an exception in the sync (but not in the raw copy). If you run option 53 on lets say 15/12, then for a few days, let the daily sync do its job in the background. On 31/12 18:00 you put card B as internal card. All changes to whatever file until 31/12 1:00 (time of last sync) on the rpi will be available on card B. But the log files will only have data for 15/12 or earlier and after 31/12 18:00 (after reboot). Between those two timings, card B has no log data. Card A had it of course.
    This is not a big issue (to me). It s just inconvenient when not knowing this and using it for testing. This brought me to some wrong conclusions.

Hope this might clarify for anyone in the future. Curious for feedback as well.

Well I wouldn’t know why this isn’t working.
If booted using card B, what does systemctl status sdrsync.timer show ?
Does /etc/systemd/system/sdrsync.service exist on B?

On logs, that’s because /var/log in a standard openhabian setup is on ZRAM, not on the SD card.