microSD mirror

Hy, I’m running openhab 4.2.1 on rasberry Pi 4
Over time the installation has grown.
I’ve some 16 bindings running and the need to make the system robust ( decent backup) .
I’ve successfully use SD mirror in the past but that’s some time ago.
I believe I have put the mirror SD in the system to test it and forgot to go back to the original sd. I have not realized that until a few days ago when i wanted to make a new mirror. This does not work the error is always that the sd is opened read-only.
I think that might be the result of running on a mirror already.
Long story short, i can’t find the original.
Tried a complete new SD and restored a backup-zip. Some part of the systems seems to run but the errors are endless. The usb- symlinks for example can’t get them to work the way i did last time. There is already a 99-coms.rules in
/etc/udev/rules.d/ last time i renamed that to 98-coms.rules but then the restore was not working. So I think there is a sequence of things to do. Do i reinstall all bindings first and then restore?
So that is where i am a system that is running OK on the mirror -SD but in a bit off a pickle to get a robust backup strategy. Advice on how to proceed ( i was bit scarred of the amanda route but maybe that is the only way out.

If you mean the mirror function within openhabian then I would say your strategy was totally fine: Create mirror SDs only when something changes (e.g. system upgrades). Of course when you need to recover persistence data then this would be not enough, but that’s another story.

The mirror SD is (from OH-view) identical to the original so carrying on with that is fine. It’s even wise to do that from time to time and use a new backup SD.

Please describe your read-only error: Which card, which message?

Thanks for your reply:
I have two problems:
1: My system is running OK on a mirrored SD ( from openhabian)and i do not have the original one anymore. I can not make a new mirror of this. I believe this is not an error but is something to prevent startup problems when both original and mirror are plugged in at startup.
Mirror is failing because the SD is opened as read only.

My understanding now is that a mirrowed SD will get you up and running in no time. But you will need to recover with a fresh MD and rebuild your system from backups you made. The best way to make these backups would be Amanda.
2: Next problem: i will need to understand amanda and use it without crashing my current system. I postponed because it has already been a big learning curve to get where i am now. Think I’m gonna use an old pi 3 and use that to experiment with amanda and NAS drive and what have you so i can leave my openhab system as is until i understand what i’m doing.
Thanks for the help and also a big thanks to the developers and maintainers it has been real fun to play with openhab. But what started as fun has become something I rely on so I need to get the backup sorted. But if i read the introduction to making backups its clear you all can say I TOLD YOU SO.

Oh no. It’s not like that. A mirror-SD is 100% working, identical to the original. You’re not in trouble.

The reason for an incremental backup like Amanda is when you want to backup many small changes, especially useful when you want to track your persistent items. In that case full backups would take too long and use too much space.

Just paste the error here to see what went wrong. Did you try a fresh card?

Tried a new card same problem
In the openhabian-config screen the mirror action ends with:
There was an error or interruption during the execution of: │
│ “50 | Backup/Restore” │
│ │
│ Please try again. If the error persists, please read │
│ /opt/openhabian/docs/openhabian-DEBUG.md or │
openhabian/docs/openhabian-DEBUG.md at main · openhab/openhabian · GitHub how │
│ to proceed. │

In the ssh window the last part of the action ends like this

  • destSizeSector=15952510976

  • (( destSizeSector/=512 ))

  • sfdisk -d /dev/mmcblk0

  • sfdisk --force /dev/sdb

sfdisk: cannot open /dev/sdb: Read-only file system

  • echo ‘/dev/mmcblk0p3 : start=31176704,size=31157248, type=83’

  • partprobe

Warning: Unable to open /dev/sdb read-write (Read-only file system). /dev/sdb has been opened read-only.

  • cond_redirect mke2fs -F -t ext4 /dev/sdb3

  • [[ -n ‘’ ]]

  • echo -e ‘\n\033[90;01m$ mke2fs -F -t ext4 /dev/sdb3 \033[39;49;00m’

$ mke2fs -F -t ext4 /dev/sdb3

  • mke2fs -F -t ext4 /dev/sdb3

mke2fs 1.46.2 (28-Feb-2021)

The file /dev/sdb3 does not exist and no size was specified.

  • return 1

  • sed -e ‘s|%DEVICE|/dev/sdb3|g’ -e ‘s|%STORAGE|/storage|g’ /opt/openhabian/includes/SD/storage.mount-template

  • cond_redirect chmod 644 /etc/systemd/system/storage.mount

  • [[ -n ‘’ ]]

  • echo -e ‘\n\033[90;01m$ chmod 644 /etc/systemd/system/storage.mount \033[39;49;00m’

$ chmod 644 /etc/systemd/system/storage.mount

  • chmod 644 /etc/systemd/system/storage.mount

  • return 0

  • cond_redirect systemctl -q daemon-reload

  • [[ -n ‘’ ]]

  • echo -e ‘\n\033[90;01m$ systemctl -q daemon-reload \033[39;49;00m’

$ systemctl -q daemon-reload

  • systemctl -q daemon-reload

  • return 0

  • cond_redirect systemctl enable --now storage.mount

  • [[ -n ‘’ ]]

  • echo -e ‘\n\033[90;01m$ systemctl enable --now storage.mount \033[39;49;00m’

$ systemctl enable --now storage.mount

  • systemctl enable --now storage.mount

If that’s the first command that’s failing, then it’s strange. I would try to completely erase all partitions and do a full format. And try another USB-adapter.
But as I had zero trouble with SD-cards I’m not an expert in that.
But definitely if you’ve got a full running system (check the log) you will be able to mirror your running card. No need to start from scratch.
and: please use code-fences (icons on top of editor) for logs, code etc for better readability.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.