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?)
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.
I saw this thread and thought to check my SD Card sync as well
Strangely I have the same errors and I have checked the folders below and originals exist with files and permissions seem correct
Expected, no. Looks like something changed about rsync.
Edit /opt/openhabian/functions/backup.bash and remove the stars in lines 460/461.
You can manually initiate a sync using menu option 55.
Thanks @mstormi , When I go to use option 55 i choose the external SD Card and am presented with a choice of 3 partitions
sda1 - 512m
sda2 59G
sda3 59.6G
I assumed I should mirror it to to sda2? and then can I assume that sda3 is just the remaining space on a 128Gb SD Card that could be used for other data (e.g. manual openhab backups)
That worked (without errors)
Here is the output
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-28 16:07:50 CEST; 1h 28min ago
TriggeredBy: ● sdrsync.timer
Process: 2437540 ExecStart=/usr/local/sbin/mirror_SD diff /dev/sda (code=exited, status=0/SUCCESS)
Main PID: 2437540 (code=exited, status=0/SUCCESS)
CPU: 4.897s
Apr 28 16:06:39 openhabian-blh systemd[1]: Starting sdrsync.service - Run SD rsync daily except semiannually (when a raw dump is made)…
Apr 28 16:06:39 openhabian-blh mirror_SD[2437544]: pgrep: pattern that searches for process name longer than 15 characters will result in zero matches
Apr 28 16:06:39 openhabian-blh mirror_SD[2437544]: Try `pgrep -f’ option to match against the complete command line.
Apr 28 16:06:39 openhabian-blh mirror_SD[2437540]: $ rsync --one-file-system --exclude=/etc/fstab --exclude=/etc/systemd/system/.mount --exclude=/opt/zram --exclude=/srv/ --delete -aKRh / /storage/syncmount
Apr 28 16:06:58 openhabian-blh mirror_SD[2437540]: $ rsync --one-file-system --delete -aKh /var/lib/openhab/persistence/ /storage/syncmount/opt/zram/persistence.bind
Apr 28 16:07:46 openhabian-blh mirror_SD[2437540]: $ rsync --one-file-system --delete -aKh /var/log/ /storage/syncmount/opt/zram/log.bind
Apr 28 16:07:50 openhabian-blh systemd[1]: sdrsync.service: Deactivated successfully.
Apr 28 16:07:50 openhabian-blh systemd[1]: Finished sdrsync.service - Run SD rsync daily except semiannually (when a raw dump is made).
Apr 28 16:07:50 openhabian-blh systemd[1]: sdrsync.service: Consumed 4.897s CPU time.
Does this need to be logged as an item to amend in the openhabian setup?