OH3 boot from SD RAW Copy


I’m running OH3 on a Raspberry 3 with a 16GB SD Card and a 32GB USB SD card connected for Mirroring purposes (via Openhabian).

I’ve setup SD Card mirroring (not Amanda) to do a SD RAW Copy.

This works fine, it executed without errors (to SDA which is my USB connected SD Card of 32GB).

Now I want to boot from this 32GB RAW SD Copy, so what I did is:

  • Shutdown my Raspberry
  • Remove my original 16GB SD Card
  • Take out the 32GB SD Card from the USB reader
  • Add this 32GB SD Card into the Raspberry SD Card slot
  • Power on Raspberry

Then nothing happens, I’ve waited 1 hour but still the Raspberry is not booting up.
If I read this 32GB card on my Windows PC it looks the same as my 16GB SD Card.

Isn’t this supposed to work by just swapping the SD card or am I missing something here ?

According to the documentation I understand I just can take the 32GB SD Crd and add it into the slot where I normally boot from and then boot.

The SD-Card should have two partitions, one of them named boot, can’t remember the second name just now.
Has your second SD-Card both partitions or did you only copy one?

It might be that Windows is only showing one partition, use Linux or macOS to check that two partitions exist :thinking:

It even has 3 partitions (the 3rd one for Amanda which I don’t use)

The problem is not viewing it via Windows but just that it doesn’t boot when inserting it in my Raspberry SD card slot

I’m not copying anything manually, I’m using the function in OpenHabian

It is. Did you try to powercycle your Pi ? Did you remove the card from the external reader ? removed the reader ? Did you do anything about firmware or kernel parameters ?
Pls show the output of sudo blkid /dev/mmcblk0* /dev/sd* and cat /boot/cmdline.txt.

Hi, thx for the answer,

to come back to your questions:
Did you try to powercycle your Pi
Yes, multiple times

Did you remove the card from the external reader
Yes, because otherwise I cannot put it in the SD CARD slot :slight_smile:

removed the reader
I tried this as well, so that only the 32GB card is in the SD Card slot, no USB ports used

Did you do anything about firmware or kernel parameters
No, this is a fresh OH3 Openhabian image, no modifications

Pls show the output of sudo blkid /dev/mmcblk0* /dev/sd*

cat /boot/cmdline.txt

Question was if you have put anything else into the external slot

can you also mount /dev/sda1 /mnt (= card that does not boot) and cat /mnt/boot/cmdline.txt

Have you tried a manual mirror run (menu 54) ?


I didn’t put anything else in the external slot (USB Card reader). I do have a zwave dongle which is being used by another USB port but that is always plugged in

openhabian@openhab3:/mnt $ cat /mnt/boot/cmdline.txt
cat: /mnt/boot/cmdline.txt: No such file or directory

openhabian@openhab3:/mnt $ cat cmdline.txt
console=serial0,115200 console=tty1 root=PARTUUID=-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

I did 54 option as well a couple of times

Attach a monitor to see if there is any output. I assume you will see something saying like root partition not found.

That’s why, root PARTUUID is bad. Try changing that to the match your ext. card’s boot partition, i.e. 203f5c9f-02

Or upgrade openHABian and system (menu 02) to latest and run mirror setup again.

If your system boots with a proper cmdline.txt from the ext. card, set debugmode=maximum in /etc/openhabian.conf and set your terminal to record the output and run menu 54 again.
We need to see why it does not properly edit your cmdline.txt.

Attached the output.txt after running option 54 again
output.txt (125.6 KB)

After option 54 it seems to work now, strange as it didn’t do this before.

So I tried again with setting up (without option 54), only 53, then it doesn’t boot, only if I manually do 54 afterwards

For further testing you can edit /opt/openhabian/functions/backup.bash and comment-out line the 2nd “dd” around line 406 so it skips copying the 2nd partition but be aware choosing to upgrade on openhabian-config start will overwrite your changes.

Unmount /dev/sda before running openhabian-config. That’s why cmdline.txt did not exist.

+ mount /dev/sda1 /storage/syncmount
mount: /storage/syncmount: /dev/sda1 already mounted on /mnt.

How old is your installation ? Did you ever upgrade the OS (menu 02 or apt-get upgrade) ?
That’s strange as I can mount it twice:

[12:28:25] root@openhab:/home/openhabian# mount|grep sda
[12:28:33] root@openhab:/home/openhabian# mount /dev/sda1 /mnt
[12:28:39] root@openhab:/home/openhabian# mount|grep sda
/dev/sda1 on /mnt type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset                                                                              =ascii,shortname=mixed,errors=remount-ro)
[12:28:42] root@openhab:/home/openhabian# mount /dev/sda1 /storage/syncmount/
[12:28:47] root@openhab:/home/openhabian# mount|grep sda
/dev/sda1 on /mnt type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset                                                                              =ascii,shortname=mixed,errors=remount-ro)
/dev/sda1 on /storage/syncmount type vfat (rw,relatime,fmask=0022,dmask=0022,codepage                                                                              =437,iocharset=ascii,shortname=mixed,errors=remount-ro)

My instance is from around mid December (before the final release, but upgraded to the final release)
Never did apt-upgrade

I’ll do this first and test again, if then not working, I’ll change the settings as per your instructions and try again.

Thx already for helping me out, much appreciated.

Also restart openhabian-config and let it upgrade. I’ve added a forced unmount before the mount that failed on your system.
We must make sure this works for others, too, so we must understand what has happened and why.
Do mount | grep sda and check the FS type is vfat.

I’ll do, thx.
It can take a couple of hours because I need to go now, I’ll keep you posted

ok. When you return remember to attach a monitor please I need to know the output

I finally had some time again and did the following:

  • apt-get upgrade (this was a huge job and I had some troubles getting OpenHab to work again, it wouldn’t start, zwave not working anymore etc.) this took a couple of hours but all is fine again
  • started openhabian-config and let it upgrade
  • started option 53 (setup mirroring)
  • when finished I turned off my raspberry and swapped my SD card (my external backup is now put into the SD Card slot)
  • booted the Raspberry and hooray, it booted up !!!

So it looks like it is working now, attached you will find my output.txt so you can see the debug

Let me know if you need me to do further testing so this will be working for everyone.

Thanks again for all your support, much appreciated!!!

Another side question : at the end it is complaining it cannot send an email because no recipient is found, this is most likely due because I’m not using Amanda and therefore never had to fill in the mailto.
Is there a way we can enter the mailto without having to setup Amanda ?

output.txt (139.1 KB)

No I think you’ve hit an already fixed bug because you didn’t update in a long time.
So others should not be affected.

You can setup the exim MTA from the menu.


Tested a few times, but it seems to fail in this scenario:

  • Setup Mirroring via menu 53 -> OK
  • Manual SD Raw Copy via menu 54 -> OK
  • the day after do again menu 54 -> NOK
    Taking a raw partition copy, be prepared this may take long such as 20-30 minutes for a 16 GB SD card
    FAILED (set random UUID)
    mount: /storage/syncmount: wrong fs type, bad option, bad superblock on /dev/sda2, missing codepage or helper program, or other error.
    sed: can’t read /storage/syncmount/etc/fstab: No such file or directory
    sed: can’t read /storage/syncmount/etc/systemd/system//storage.mount: No such file or directory
    umount: /storage/syncmount: not mounted.
    OK (dirty bit on fsck /dev/sda2 is normal)
  • if I start with menu 53 again, it works again, then 53, it works again for 1 time, 2nd time it fails again

In all cases also no mail is send, even though MTA has been setup properly and is working as I receive other mails from openhabian (like when launching a config backup)

what do you mean by NOK ? It does not boot ? option 54 fails with an error ? other ?
Provide a full log (debugmode=maximum) please else this is useless guessing.