How to check if sd mirror is working correctly

  • Platform information:
    • Hardware: Raspberry Pi 4
    • OS: openhabian 4.3
    • Issue of the topic: how to check if sd mirroring is working

Hi,
i set up sd mirroring with option 53 , timer seem to be created and “systemctl status sdrsync.servive” brings back last execution time but also some errors

NEXT                         LEFT                  LAST                         PASSED       UNIT                         ACTIVATES
Mon 2025-04-14 12:05:38 CEST 1h 9min left          Mon 2025-04-14 10:06:50 CEST 48min ago    sdrsync.timer                sdrsync.service

$ sudo systemctl status sdrsync.service
○ sdrsync.service - Run SD rsync daily except semiannually (when a raw dump is made)
Loaded: loaded (/etc/systemd/system/sdrsync.service; static)
Active: inactive (dead) since Mon 2025-04-14 10:07:08 CEST; 49min ago
TriggeredBy: ● sdrsync.timer
Process: 107824 ExecStart=/usr/local/sbin/mirror_SD diff /dev/sda (code=exited, status=0/SUCCESS)
Main PID: 107824 (code=exited, status=0/SUCCESS)
CPU: 7.076s

Apr 14 10:06:50 ohmaster mirror_SD[107824]: $ rsync --one-file-system --exclude=/etc/fstab --exclude=/etc/systemd/system/.mount --exclude=/opt/zram --exclude=/srv/ --delete -aKRh / /storage/syncmount
Apr 14 10:07:07 ohmaster mirror_SD[107824]: $ rsync --one-file-system --delete -aKh /var/lib/openhab/persistence/* /storage/syncmount/opt/zram/persistence.bind
Apr 14 10:07:07 ohmaster mirror_SD[107841]: rsync: [sender] link_stat "/var/lib/openhab/persistence/" failed: No such file or directory (2)
Apr 14 10:07:07 ohmaster mirror_SD[107841]: rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
Apr 14 10:07:07 ohmaster mirror_SD[107824]: $ rsync --one-file-system --delete -aKh /var/log/
/storage/syncmount/opt/zram/log.bind
Apr 14 10:07:07 ohmaster mirror_SD[107844]: rsync: [sender] link_stat “/var/log/*” failed: No such file or directory (2)
Apr 14 10:07:07 ohmaster mirror_SD[107844]: rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
Apr 14 10:07:08 ohmaster systemd[1]: sdrsync.service: Deactivated successfully.
Apr 14 10:07:08 ohmaster systemd[1]: Finished sdrsync.service - Run SD rsync daily except semiannually (when a raw dump is made).
Apr 14 10:07:08 ohmaster systemd[1]: sdrsync.service: Consumed 7.076s CPU time.

how can i decide if those errors are “minor” or if i have to investigate more in depth?

is there a way to check sd mirror (without to put the second sd card into primary slot and to reboot?)
would it be a way to change some minor information ,i.e. a description of something, and to look on the second card if the modification has been transferred? (and could you please explain how to get this done?)

Kind regards, marco

Hi :slight_smile:

first things first: It would have been better to also mark the copied text from console as text, this would have preserved the original line breaks for better readability.

Afaik sdrsync is a 2-part-job.
The first sync is a complete copy of the sd card, this is executed twice a year (very time consuming, maybe openHAB has to be stopped while backup?).
On every day without the full copy, the file system is rsync’ed (i.e., check for every file if it’s altered, if so, copy and replace to the backup).
This is done for / (or ‘root’ file system, excluding some stuff which isn’t “valid” for the backup),
/var/lib/openhab/persistence/ and /var/log/.
These two directories caused the error, so you are missing rrd4j data as well as all logging.
I’m not sure about why these two directories weren’t available at the time, but openHAB will be able to start without the stored data. On the other hand, you should always get a complete backup, not only the (more or less) static files.

To elaborate: /var/lib/openhab/persistence/ and /var/log/ are part of the ZRAM file System, therefor they need to be copied separate.