Mirror fails to boot

I’ havnig trouble with mirroring. I can’t boot from a mirrored SD card after more than one mirror. I’ve tried with multiple SD cards, the first mirror will work but any further full mirrors to the same SD card fail to boot. The mirror process completes without fail. I also had a working mirror fail to boot after re-syncing. I’ve tried with multiple pi’s and multiple SD cards. All with the same result. I then tried a fresh openhabian image. This mirrored but again the next mirror failed to boot.

Can you not re-mirror to an SD card that’s already been mirrored? Is there something I can change to have my mirror boot successfully?

In theory you can but probably noone ever tested but you.

You don’t give enough details it takes to answer. Do this upfront next time please.
And to be frank your description is confusing.

What HW do you use ?
How do you boot - by putting it into the internal SD slot? By specifying boot parameters (if so how?)
Do you have any card in the external reader when you try booting ?
Do you have any other mass storage attached?
How do you initiate mirroring ?
Set debugmode=maximum (see debug log) and initiate mirroring then repeat until you have a mirror that does not work then provide the log of its initiation and show the outputs of lsblk and blkid.

Interestingly I have run menu option 53 - Setup SD Mirroring 3 times since my first post and it worked each time. This kept failing to boot previously.

I then tried menu option 55 - Sync SD. After the process finished I tried booting from the synced card but it failed to boot. This fail twice in a row (menu item 53, susessful boot, menu item 55, failed to boot).

Below are answers to your questions and the output of menu option 55 - Sync SD, lsblk and blkid.

:black_small_square: Raspberry Pi4 4gb
:black_small_square: I’m booting from the internal SD slot
:black_small_square: I haven’t changed any boot parameters
:black_small_square: When booting from the mirrored drive I don’t have an external card reader attached. Just internal SD card (the mirror), power and ethernet
:black_small_square: No mass storage attached
:black_small_square: I’ve tried initiating mirroring using openhabian-config menu item 53 - Setup SD Mirroring, 54 - Raw copy SD and also using dd from my Mac with an external card reader.

Doesn’t the openhabian backup setup periodically full mirror? This is what led me to think that I was able to mirror to an SD with an existing mirror. I’ve tried formatting an SD card that is not booting and then mirroring to it again but this also didn’t boot.

Debug output:
I’ve tried include this output of the the Sync SD but it’s too long to be allowed to post. What the best way to share this?

lsblk:

NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1   58G  0 disk 
├─sda1        8:1    1  256M  0 part 
├─sda2        8:2    1 29.5G  0 part 
└─sda3        8:3    1 28.3G  0 part /storage
mmcblk0     179:0    0 29.7G  0 disk 
├─mmcblk0p1 179:1    0  256M  0 part /boot
└─mmcblk0p2 179:2    0 29.5G  0 part /
zram0       254:0    0  200M  0 disk [SWAP]
zram1       254:1    0  150M  0 disk /opt/zram/zram1

blkid:

/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="DC3E-E470" TYPE="vfat" PARTUUID="dcba1b89-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="a7adb26a-8b87-4729-99c8-9f5ac069d51e" TYPE="ext4" PARTUUID="dcba1b89-02"
/dev/sda1: LABEL_FATBOOT="boot" LABEL="boot" UUID="DC3E-E470" TYPE="vfat" PARTUUID="139473a5-01"
/dev/sda2: LABEL="rootfs" UUID="48b47de8-02b6-406c-8c58-f133141ce42f" TYPE="ext4" PARTUUID="139473a5-02"
/dev/sda3: UUID="c93edcd7-9840-48c6-a4f5-ab8893311e4a" TYPE="ext4" PARTUUID="139473a5-03"
/dev/zram0: LABEL="zram-config0" UUID="29960e6c-7977-42c4-ac87-f3e176254167" TYPE="swap"

What does “fail to boot” mean? What’s the console output then?
There’s nothing in your post that would explain it.

As in the Pi boot output (below)? or the Openhabian console? How do I show this? Login to console and run sync?

I’ve attached a photo of the Pi boot sequence.

When I initiated openhabian-config menu option 55 I selected partition sda2. (my understanding is sda1=boot and sda3=amanda storage)

After the boot failed i initiated menu option 55 again. The output of this sync fits in this post and is below.
Sync output:

++ whiptail --title 'Welcome to the openHABian Configuration Tool [main]patchday-20210118-1221(c1919f7)' --menu Backup/Restore 14 116 7 --cancel-button Back --ok-button Execute '50 | Backup openHAB config' 'Backup the current active openHAB configuration' '51 | Restore an openHAB config' 'Restore a previous openHAB configuration from backup' '52 | Amanda System Backup' 'Set up Amanda to comprehensively backup your complete openHABian box' '53 | Setup SD mirroring' 'Setup mirroring of internal to external SD card' '   | Remove SD mirroring' 'Disable mirroring of SD cards' '54 | Raw copy SD' 'Raw copy internal SD to external disk / SD card' '55 | Sync SD' 'Rsync internal SD to external disk / SD card'
+ choice2='55 | Sync SD'
+ '[' 0 -eq 1 ']'
+ '[' 1 -eq 255 ']'
+ case "$choice2" in
+ mirror_SD diff
+ local src=/dev/mmcblk0
+ local dest=/dev/sda
+ local start
+ local destPartsLargeEnough=true
+ local storageDir=/storage
+ local syncMount=/storage/syncmount
+ local dirty=no
+ local repartitionText
+ local 'dumpInfoText=For your information as the operator of this openHABian system:\nA timed background job to run semiannually has just created a full raw device copy of your RPI'\''s internal SD card.\nOnly partitions to contain openHABian (/boot and / partitions 1 & 2) were copied.'
+ local partUUID
+ [[ 1 -eq 1 ]]
+ [[ -n 1 ]]
+ select_blkdev '^sd' 'Setup SD mirroring' 'Select USB device to copy the internal SD card data to'
+ [[ -z 1 ]]
+ array=()
+ declare -a array
+ read -r id foo foo size foo foo foo
++ lsblk -i
++ tr -d '`\\|'
++ tr -d '\\-'
++ grep -E '^sd'
+ array+=("$id" "$size")
+ read -r id foo foo size foo foo foo
+ [[ 2 -eq 0 ]]
+ (( count=2 + 8 ))
++ whiptail --title 'Setup SD mirroring' --cancel-button Cancel --ok-button Select --menu '\nSelect USB device to copy the internal SD card data to' 10 76 0 sda 58G
+ retval=sda
+ dest=/dev/sda
+ [[ /dev/mmcblk0 == \/\d\e\v\/\s\d\a ]]
++ blockdev --getsize64 /dev/sda
+ [[ -n 62277025792 ]]
+ mount
+ grep -Eq '$dest[12]'
+ [[ -d /storage/syncmount ]]
+ [[ diff == \r\a\w ]]
+ [[ diff == \d\i\f\f ]]
+ pgrep 'dd if=/dev/mmcblk0'
+ [[ -n 1 ]]
+ select_blkdev '^-sd' 'select partition' 'Select the partition to copy the internal SD card data to'
+ [[ -z 1 ]]
+ array=()
+ declare -a array
+ read -r id foo foo size foo foo foo
++ lsblk -i
++ tr -d '`\\|'
++ grep -E '^-sd'
++ tr -d '\\-'
+ array+=("$id" "$size")
+ read -r id foo foo size foo foo foo
+ array+=("$id" "$size")
+ read -r id foo foo size foo foo foo
+ array+=("$id" "$size")
+ read -r id foo foo size foo foo foo
+ [[ 6 -eq 0 ]]
+ (( count=6 + 8 ))
++ whiptail --title 'select partition' --cancel-button Cancel --ok-button Select --menu '\nSelect the partition to copy the internal SD card data to' 14 76 0 sda1 256M sda2 29.5G sda3 28.3G
+ retval=sda2
+ dest=/dev/sda2
+ mount /dev/sda2 /storage/syncmount
+ mountpoint -q /storage/syncmount
+ cond_redirect rsync --one-file-system -avRh / /storage/syncmount
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ rsync --one-file-system -avRh / /storage/syncmount \033[39;49;00m'

$ rsync --one-file-system -avRh / /storage/syncmount 
+ rsync --one-file-system -avRh / /storage/syncmount
sending incremental file list
/dev/
/etc/fake-hwclock.data
/etc/openhabian.conf
/etc/openhabian.conf.BAK
/etc/default/cpufrequtils
/home/openhabian/.bash_history
/opt/openhabian/.git/
/opt/openhabian/.git/FETCH_HEAD
/opt/openhabian/.git/HEAD
/opt/openhabian/.git/config
/opt/openhabian/.git/index
/opt/openhabian/.git/logs/HEAD
/opt/zram/
/opt/zram/log.bind/
/opt/zram/log.bind/auth.log
/opt/zram/log.bind/btmp
/opt/zram/log.bind/daemon.log
/opt/zram/log.bind/debug
/opt/zram/log.bind/kern.log
/opt/zram/log.bind/lastlog
/opt/zram/log.bind/messages
/opt/zram/log.bind/syslog
/opt/zram/log.bind/syslog.1
/opt/zram/log.bind/syslog.2.gz
/opt/zram/log.bind/syslog.3.gz
/opt/zram/log.bind/syslog.4.gz
/opt/zram/log.bind/syslog.5.gz
/opt/zram/log.bind/syslog.6.gz
/opt/zram/log.bind/syslog.7.gz
/opt/zram/log.bind/user.log
/opt/zram/log.bind/wtmp
/opt/zram/log.bind/apt/
/opt/zram/log.bind/apt/eipp.log.xz
/opt/zram/log.bind/exim4/
/opt/zram/log.bind/exim4/mainlog
/opt/zram/log.bind/exim4/mainlog.1
/opt/zram/log.bind/exim4/mainlog.10.gz
/opt/zram/log.bind/exim4/mainlog.2.gz
/opt/zram/log.bind/exim4/mainlog.3.gz
/opt/zram/log.bind/exim4/mainlog.4.gz
/opt/zram/log.bind/exim4/mainlog.5.gz
/opt/zram/log.bind/exim4/mainlog.6.gz
/opt/zram/log.bind/exim4/mainlog.7.gz
/opt/zram/log.bind/exim4/mainlog.8.gz
/opt/zram/log.bind/exim4/mainlog.9.gz
/opt/zram/log.bind/grafana/
/opt/zram/log.bind/grafana/grafana.log
/opt/zram/log.bind/grafana/grafana.log.2021-02-25.001
/opt/zram/log.bind/journal/728916cd7ee843789ef62375fba8d7fe/
/opt/zram/log.bind/journal/728916cd7ee843789ef62375fba8d7fe/system.journal
/opt/zram/log.bind/journal/728916cd7ee843789ef62375fba8d7fe/system@0005bc1e46650a9f-3ac0fae4482b6f9a.journal~
/opt/zram/log.bind/journal/728916cd7ee843789ef62375fba8d7fe/user-1000.journal
/opt/zram/log.bind/journal/728916cd7ee843789ef62375fba8d7fe/user-1000@7d752b1fe73649be93a41aa464f267a9-000000000000a1c0-0005bc1e412f6e06.journal
/opt/zram/log.bind/journal/728916cd7ee843789ef62375fba8d7fe/user-1001.journal
/opt/zram/log.bind/mosquitto/
/opt/zram/log.bind/mosquitto/mosquitto.log
/opt/zram/log.bind/openhab/
/opt/zram/log.bind/openhab/events.log
/opt/zram/log.bind/openhab/events.log.1
/opt/zram/log.bind/openhab/events.log.2
/opt/zram/log.bind/openhab/events.log.3
/opt/zram/log.bind/openhab/events.log.4
/opt/zram/log.bind/openhab/events.log.5
/opt/zram/log.bind/openhab/events.log.6
/opt/zram/log.bind/openhab/events.log.7
/opt/zram/log.bind/openhab/openhab.log
/opt/zram/log.bind/openhab/openhab.log.1
/opt/zram/log.bind/openhab/openhab.log.2
/opt/zram/log.bind/openhab/openhab.log.3
/opt/zram/log.bind/openhab/openhab.log.4
/opt/zram/log.bind/openhab/openhab.log.5
/opt/zram/log.bind/openhab/openhab.log.6
/opt/zram/log.bind/openhab/openhab.log.7
/opt/zram/log.bind/samba/
/opt/zram/log.bind/samba/log.nmbd
/opt/zram/log.bind/samba/log.smbd
/opt/zram/log.bind/unattended-upgrades/
/opt/zram/log.bind/unattended-upgrades/unattended-upgrades.log
/opt/zram/persistence.bind/mapdb/
/opt/zram/persistence.bind/mapdb/storage.mapdb.t
/opt/zram/zram1/
/run/
/srv/openhab-sys/runtime/system/org/eclipse/platform/org.eclipse.osgi/3.12.100/
/srv/openhab-userdata/.cache/JNA/temp/
/srv/openhab-userdata/cache/
/srv/openhab-userdata/cache/1614170700915.log
/srv/openhab-userdata/cache/org.eclipse.osgi/
/srv/openhab-userdata/cache/org.eclipse.osgi/framework.info.130
/srv/openhab-userdata/cache/org.eclipse.osgi/.manager/
/srv/openhab-userdata/cache/org.eclipse.osgi/.manager/.fileTable.130
/srv/openhab-userdata/cache/org.eclipse.osgi/.manager/.fileTable.131
/srv/openhab-userdata/cache/org.eclipse.osgi/11/data/digraph.json
/srv/openhab-userdata/cache/org.eclipse.osgi/141/data/configdispatcher_pid_list.json
/srv/openhab-userdata/cache/org.eclipse.osgi/54/data/FeatureDeploymentListener.cfg
/srv/openhab-userdata/jsondb/org.openhab.core.config.discovery.DiscoveryResult.json
/srv/openhab-userdata/jsondb/backup/
/srv/openhab-userdata/jsondb/backup/1614213758606--org.openhab.core.config.discovery.DiscoveryResult.json
/srv/openhab-userdata/persistence/mapdb/
/srv/openhab-userdata/persistence/mapdb/storage.mapdb.t
/srv/openhab-userdata/tmp/
/srv/openhab-userdata/tmp/karaf.pid
/srv/openhab-userdata/tmp/port
/srv/openhab-userdata/tmp/.paxweb12990606343234961561/
/srv/openhab-userdata/tmp/fileinstall--8296218574931054936/
/srv/openhab-userdata/tmp/instances/instance.properties
/tmp/
/tmp/zram-device-list
/tmp/.ICE-unix/
/tmp/.Test-unix/
/tmp/.X11-unix/
/tmp/.XIM-unix/
/tmp/.font-unix/
/tmp/hsperfdata_openhab/
/tmp/systemd-private-ad59f93e905e46bf9179a2a3f6896f21-systemd-timesyncd.service-zDWeIm/
/tmp/systemd-private-ad59f93e905e46bf9179a2a3f6896f21-systemd-timesyncd.service-zDWeIm/tmp/
/usr/local/lib/zram-config/
/usr/local/share/zram-config/log/zram-config.log
/usr/share/firemotd/data/FireMotD.json
/usr/share/openhab/runtime/system/org/eclipse/platform/org.eclipse.osgi/3.12.100/
/var/cache/apt/
/var/cache/apt/pkgcache.bin
/var/cache/apt/srcpkgcache.bin
/var/cache/samba/
/var/cache/samba/browse.dat
/var/cache/samba/gencache.tdb
/var/lib/alsa/
/var/lib/alsa/asound.state
/var/lib/apt/lists/partial/
/var/lib/dhcpcd5/eth0.lease
/var/lib/exim4/
/var/lib/exim4/config.autogenerated
/var/lib/grafana/
/var/lib/grafana/grafana.db
/var/lib/influxdb/data/_internal/monitor/14/
/var/lib/influxdb/data/_internal/monitor/14/fields.idx
/var/lib/influxdb/data/_internal/monitor/16/
/var/lib/influxdb/data/_internal/monitor/16/fields.idx
/var/lib/influxdb/data/_internal/monitor/17/
/var/lib/influxdb/data/_internal/monitor/17/fields.idx
/var/lib/influxdb/data/_internal/monitor/19/
/var/lib/influxdb/data/_internal/monitor/19/fields.idx
/var/lib/influxdb/data/_internal/monitor/20/
/var/lib/influxdb/data/_internal/monitor/20/fields.idx
/var/lib/influxdb/data/_internal/monitor/21/
/var/lib/influxdb/data/_internal/monitor/21/fields.idx
/var/lib/influxdb/data/openhab_db/autogen/15/
/var/lib/influxdb/data/openhab_db/autogen/15/fields.idx
/var/lib/influxdb/data/openhab_db/autogen/18/
/var/lib/influxdb/data/openhab_db/autogen/18/fields.idx
/var/lib/influxdb/data/openhab_db/autogen/2/
/var/lib/influxdb/data/openhab_db/autogen/2/fields.idx
/var/lib/influxdb/data/openhab_db/autogen/9/
/var/lib/influxdb/data/openhab_db/autogen/9/fields.idx
/var/lib/influxdb/wal/_internal/monitor/20/
/var/lib/influxdb/wal/_internal/monitor/21/_00001.wal
/var/lib/influxdb/wal/openhab_db/autogen/18/_00001.wal
/var/lib/mosquitto/
/var/lib/mosquitto/mosquitto.db
/var/lib/openhab/.cache/JNA/temp/
/var/lib/openhab/cache/
/var/lib/openhab/cache/1614170700915.log
/var/lib/openhab/cache/org.eclipse.osgi/
/var/lib/openhab/cache/org.eclipse.osgi/framework.info.130
/var/lib/openhab/cache/org.eclipse.osgi/.manager/
/var/lib/openhab/cache/org.eclipse.osgi/.manager/.fileTable.130
/var/lib/openhab/cache/org.eclipse.osgi/.manager/.fileTable.131
/var/lib/openhab/cache/org.eclipse.osgi/11/data/digraph.json
/var/lib/openhab/cache/org.eclipse.osgi/141/data/configdispatcher_pid_list.json
/var/lib/openhab/cache/org.eclipse.osgi/54/data/FeatureDeploymentListener.cfg
/var/lib/openhab/jsondb/org.openhab.core.config.discovery.DiscoveryResult.json
/var/lib/openhab/jsondb/backup/
/var/lib/openhab/jsondb/backup/1614213758606--org.openhab.core.config.discovery.DiscoveryResult.json
/var/lib/openhab/persistence/
/var/lib/openhab/tmp/
/var/lib/openhab/tmp/karaf.pid
/var/lib/openhab/tmp/port
/var/lib/openhab/tmp/.paxweb12990606343234961561/
/var/lib/openhab/tmp/fileinstall--8296218574931054936/
/var/lib/openhab/tmp/instances/instance.properties
/var/lib/samba/
/var/lib/samba/wins.dat
/var/lib/samba/wins.tdb
/var/lib/samba/private/msg.sock/
/var/lib/samba/private/msg.sock/1150
/var/lib/samba/private/msg.sock/1161
/var/lib/systemd/random-seed
/var/lib/systemd/rfkill/
/var/lib/systemd/rfkill/platform-fe300000.mmcnr:wlan
/var/lib/systemd/timesync/clock
/var/log/
/var/log/auth.log
/var/log/btmp
/var/log/daemon.log
/var/log/debug
/var/log/kern.log
/var/log/lastlog
/var/log/messages
/var/log/syslog
/var/log/syslog.1
/var/log/syslog.2.gz
/var/log/syslog.3.gz
/var/log/syslog.4.gz
/var/log/syslog.5.gz
/var/log/syslog.6.gz
/var/log/syslog.7.gz
/var/log/user.log
/var/log/wtmp
/var/log/apt/
/var/log/apt/eipp.log.xz
/var/log/exim4/
/var/log/exim4/mainlog
/var/log/exim4/mainlog.1
/var/log/exim4/mainlog.10.gz
/var/log/exim4/mainlog.2.gz
/var/log/exim4/mainlog.3.gz
/var/log/exim4/mainlog.4.gz
/var/log/exim4/mainlog.5.gz
/var/log/exim4/mainlog.6.gz
/var/log/exim4/mainlog.7.gz
/var/log/exim4/mainlog.8.gz
/var/log/exim4/mainlog.9.gz
/var/log/grafana/
/var/log/grafana/grafana.log
/var/log/grafana/grafana.log.2021-02-25.001
/var/log/journal/728916cd7ee843789ef62375fba8d7fe/
/var/log/journal/728916cd7ee843789ef62375fba8d7fe/system.journal
/var/log/journal/728916cd7ee843789ef62375fba8d7fe/system@0005bc1e46650a9f-3ac0fae4482b6f9a.journal~
/var/log/journal/728916cd7ee843789ef62375fba8d7fe/user-1000.journal
/var/log/journal/728916cd7ee843789ef62375fba8d7fe/user-1000@7d752b1fe73649be93a41aa464f267a9-000000000000a1c0-0005bc1e412f6e06.journal
/var/log/journal/728916cd7ee843789ef62375fba8d7fe/user-1001.journal
/var/log/mosquitto/
/var/log/mosquitto/mosquitto.log
/var/log/openhab/
/var/log/openhab/events.log
/var/log/openhab/events.log.1
/var/log/openhab/events.log.2
/var/log/openhab/events.log.3
/var/log/openhab/events.log.4
/var/log/openhab/events.log.5
/var/log/openhab/events.log.6
/var/log/openhab/events.log.7
/var/log/openhab/openhab.log
/var/log/openhab/openhab.log.1
/var/log/openhab/openhab.log.2
/var/log/openhab/openhab.log.3
/var/log/openhab/openhab.log.4
/var/log/openhab/openhab.log.5
/var/log/openhab/openhab.log.6
/var/log/openhab/openhab.log.7
/var/log/samba/
/var/log/samba/log.nmbd
/var/log/samba/log.smbd
/var/log/unattended-upgrades/
/var/log/unattended-upgrades/unattended-upgrades.log
/var/tmp/
/var/tmp/systemd-private-ad59f93e905e46bf9179a2a3f6896f21-systemd-timesyncd.service-WlHjmg/
/var/tmp/systemd-private-ad59f93e905e46bf9179a2a3f6896f21-systemd-timesyncd.service-WlHjmg/tmp/

sent 209.75M bytes  received 17.37K bytes  5.59M bytes/sec
total size is 6.22G  speedup is 29.64
+ return 0
+ umount /storage/syncmount
+ '[' 0 -ne 0 ']'
+ true
+ show_main_menu
+ local choice
+ local version
+++ get_git_revision
+++ local branch
+++ local latestTag
+++ local revCount
+++ local shorthash
++++ git -C /opt/openhabian rev-parse --abbrev-ref HEAD
+++ branch=main
++++ git -C /opt/openhabian describe --tags --abbrev=0
+++ latestTag=patchday-20210118
++++ git -C /opt/openhabian log --oneline
++++ wc -l
+++ revCount=1221
++++ git -C /opt/openhabian log --pretty=format:%h -n 1
+++ shorthash=c1919f7
+++ echo '[main]patchday-20210118-1221(c1919f7)'
++ whiptail --title 'Welcome to the openHABian Configuration Tool [main]patchday-20210118-1221(c1919f7)' --menu 'Setup Options' 18 116 11 --cancel-button Exit --ok-button Execute '00 | About openHABian' 'Information about the openHABian project and this tool' '' '' '01 | Select Branch' 'Select the openHABian config tool version ("branch") to run' '02 | Upgrade System' 'Upgrade all installed software packages (incl. openHAB) to their latest version' '03 | Install openHAB' 'Install or upgrade to openHAB release 3' '' '' '10 | Apply Improvements' 'Apply the latest improvements to the basic openHABian setup ►' '20 | Optional Components' 'Choose from a set of optional software components ►' '30 | System Settings' 'A range of system and hardware related configuration steps ►' '40 | openHAB Related' 'Switch the installed openHAB version or apply tweaks ►' '50 | Backup/Restore' 'Manage backups and restore your system ►'

Well it doesn’t fail to boot does it.
Screenshots are unreadable therefore discouraged but it shows your box does boot.
It cannot mount a disk but I cannot see which one.
Just a guess: it’s sda3. If you use auto-back or manually setup Amanda, it’s there on the mirror.
But running mirroring again from the mirror will not mirror it, it’s just mirroring partitions 1 & 2 so
/dev/sda3 does not exist or is trash so cannot be mounted on boot.

Make an fsck of your failing SD and mount it as /mnt.
Try to remove /mnt/etc/systemd/system/storage.mount to see if it boots then.

Long story short: Only take mirrors of the original or adapt it afterwards.