Backup SD-Card with dd

I know this is not directly related to openhHAB oder openHABian but it might be of interest for a few non-expert linux users like me…

Via a cronjob I make a copy of my SD-Card with dd like
dd if=/dev/sda of=/dev/sdb bs=16M

Backup works absolutely fine: I switched of my Raspberry, I unplugged SDA Card, I left SDB Card where it is and switched on Raspberry again. openHAB is running fine. so this is a perfect failover solution at least if your SD-Card is out of order.

The question is, what happens if Raspberry is booting. How does the OS decide which SD-Card to boot from as both Cards are bootable? To ask this question in a different way: How can I “force” the OS to boot from SDA, not from SDB?

Does this https://www.tomshardware.com/how-to/boot-raspberry-pi-4-usb help ?
Are partition UUIDS used in /etc/fstab ? These do not differ between original and clone …

Sorry, that links is not related to my question or at least I cannot see it.
The link is about setting up Raspberry to boot from USB drive. This is not what I mean.

fstab:

proc                  /proc           proc    defaults          0       0
PARTUUID=9f695aad-01 /boot           vfat    defaults          0       2
PARTUUID=9f695aad-02  /               ext4    defaults,noatime  0       1

Is it really a question of fstab UUIDS? By the time where Raspberry reads fstab, it has already made the decision where to boot from.

Why bother? openHABian has that capability built in.

And no it’s absolutely not as simple as it seems at first glance.

Is it possible to boot from your Backup SD-Card without any further interaction?

ok - could you give me some buzz words so that I can start learning further?

Read the link. When you have put it into the internal card reader, yes.

I read it crefully but cannot find any information as to that the backup-Card is bootable.
All I can read is, at least this is how I understand it, that I need to setup up a new image and restore from backup-Card.

But I would be thankful if someone with Linux skills could answer my question as this helps me to better understand the matter.

No, sorry. Turn to a Linux forum. openHABian provides the functionality to all users and it’s more than enough work for me to support that. Additional DIY solutions that do more or less the same will just mean additional work and time needed to invest to sort out issues and that I’m not keen on.

Sorry - I disagree. The backup concept was created at the time where it was not possible to boot from USB drives. This has changed.

BUT, please do not answer here any further and waste your time. I really appreciate your work and your time and I really do not expect, that especially you are answering low level questions like mine (this is not ironic ar sarcastic) - I really mean it.

Not exactly. The auto backup concept is intentionally independent of USB boot and works for any RPi. There’s no need to boot from USB whatsoever.

have a look at BerryBoot v2.0 - bootloader / universal operating system installer [BerryTerminal] if that is an answer to your question.

And this results again in the discussion as to wether it makes sense to replace the SD-Card with a USB SSD. I know your opinion already and do not want to diskuss this further with respect to your time

1 Like

Hmm. That boot-loader will be copied to the target-SD as well, so that there are 2 (competing) bootmanagers.
For a better understanding I would like just to ask, how Raspberry makes the “decision” where to boot from if you have to bootable SD-Cards/SSDs attached to it. Does it give the SD slot a higher priority by default against a USB device?

Comparing to a PC the bootorder is predefined in its built-in BIOS. So everything is clear where a PC has to boot from even BEFORE a bootloader comes into the game.