Openhabian SD mirror not booting

I have been testing SD card mirroring using the openhabian-config menu. I have had some success but am having trouble replicating results. I have no problem mirroring the main SD card to a card in an external card reader. I’ve been searching through the forum and have found what seem like people having a similar problem. If I was to make a guess I’d say the problem is with the PARTUUID but where to from there.

I’m running openhabian 3 on a pi4 4gb. in my fault finding I’ve connected the pi (normally headless) to my TV to see where the boot is hanging. I have attached a photo of what’s displayed. Apologies for not being able to copy and past directly to this post.

Below is a rundown of my testing.

I’ve tried with mirroring to 3 different SD cards. All boot the first time I mirror to them but after additional mirrors are SD syncs they fail to boot. On my last attempt I mirrored to an SD card then tested that mirror. It booted perfectly. I then returned to booting off the ‘master’ SD card and returned the mirrored SD card, that had just booted, to the external reader. According to the sdr*.timer files the next sync was due to take place at 2am. I made a change to my site map to then prove the auto sync but the next morning when I tested the mirrored card it wouldn’t boot.

I’ve also tried the dd function on my mac to clone the SD card. This worked but is hanging at the same point during boot.

I’ve tried multiple variations on the above description. It seems that once a card doesn’t boot it won’t boot again even if re-mirrored. When I mirror to a new card I use the openhabian-config menu to disable mirroring before then setting it up again for the new card.

I’ve had a similar experience with enabling backup from within openhabian.conf file during initial setup. It worked on initial setup, I then tested the backup, it booted as expected. I then performed another initial setup of openhabian (for unrelated issue) using the same cards but now the backup didn’t work - it would boot.

What am I missing? is this related to PARTUUID? How would I fix this?

Having similar problems. I’m currently running OH 3.1.0 on RPi4 with 16G SD card and happy with the current base setup, so at this point want to back up prior to continuing. Following the documentation here I’ve inserted a brand new 32G SD card in a USB reader and plugged into the RPi. Using openhabian-conf I selected 53 Setup SD mirroring and ~ 20 min later the command completed with “OK”.

I then switch over to the 32G back up card (I leave the USB reader unplugged) and boot the RPi. It starts to boot but then hangs at the same point above. If I plug in the USB reader (either with or without another SD card installed) it gets a few steps further but then hangs at:

  • Platform information:
    • Hardware: RPi4 2G 16G SD Card
    • OS: Linux openhabian 5.10.63-v7l+ #1459 SMP Wed Oct 6 16:41:57 BST 2021 armv7l
    • Java Runtime Environment: OpenJDK Runtime Environment Zulu11.45+27-CA (build 11.0.10+9-LTS)

Hi Stuart. That sounds similar to what I was experiencing. I’ve been using a backup script that backs up my conf files daily to a usb stick and then periodically mirroring my SD card offline (using my mac). I’m not promoting this as a solution as Openhab has a built in solution.

If I don’t have the usb stick plugged into my pi when booting, the boot will hang beacue it can’t out the drive. I got around this by changing the usb stick to automount in fstab. This way the usb is mounted when required and doesn’t stop the system from booting.

I wonder if something similar is happening. I am no expert and very much learning as I go but looking at your screenshot I think your system might be looking for the SD card you mirrored to (and are now trying to boot from). This might seem strange (and may be pointless) but I’d try to clone the 32gb SD card that you mirrored to. Then insert the original mirror into the pi and the cloned mirror into the sd reader that’s plugged into your pi. Will it boot now?

I haven’t had time to test this theory but to me this looks like your system is trying to mount sda. I’m sure someone could prove me right or wrong. I’d be curious to hear your results.

do you have any /dev/sdaX mounted when running your original card ?
If so that’s what the system attempts when you boot from the mirror.
The problem would then be that you change hardware without changing the respective OS config.

Check for entries in /etc/fstab(there should not be any !) and unit files /etc/systemd/system/*.mount

/etc/fstab is clean
no unit files: /etc/systemd/system/*.mount

There is this mount point with original card

/dev/sda3 on /storage type ext4 (rw,relatime)

If this is the problem, I’m not sure how to fix it.

This cannot be unless you modified your setup, whenever /storage is mounted it must happen somewhere on boot, per default /etc/systemd/system/storage.mount.

If you setup mirror, that file is changed on the mirror so the partition is not mounted from /dev/sda but from /dev/mmcblk0 if you boot from that mirror SD. Check /etc/systemd/system/storage.mount on the mirror disk.

If that is not there you have messed up something I guess, possibly because you changed the storage at some point in time. Or any other reason out of many many possibilities we won’t find out.

Find out where the mount happens, remove it, mirror again.

Ah my bad. Somehow I missed /etc/systemd/system/storage.mount which does exist :roll_eyes: and contains:

[Mount]
What=/dev/sda3
Where=/storage
Type=ext4

I’ll remove, then mirror again to see if that fixes it. Thanks.

Check storage.mount on the mirror card after setting up mirroring again.
I believe it should be correct but gets overwritten later when sdrsync.service run.
Fixed in do not sync /etc/systemd/system/*.mount · openhab/openhabian@0803181 · GitHub I hope

This may or may not have been the OP’s problem, too.

1 Like

I can confirm that removing the mount in /etc/systemd/system/storage.mount does fix the problem. Thanks!