0

I am running a Pi 4 with the Raspberry Pi 64-bit Bookworm GUI OS image in a Generac generator using Genmon from github to graphically monitor the generator status. The Pi is headless and I manage it through terminal sessions and with RealVNC. I'm new to Linux and the Pi; as I work through this I have discovered that on occasion I have had to go to a backup SD card because of an app destroying what I've done so far, finger-checks, or simply not following app install directions carefully. I have several 64GB micro-SD cards and take full clone backups often along the way, documenting the point when each clone was made.

To date, to clone the OS I have taken the running OS out of the generator Pi, booted it in a second Pi 4 in the house, and used the GUI SD Card Copier utility to make the clone. This is simple, quick, and painless and beats other backup methods I have found so far. But to make the clone using the second Pi I have to shut down the generator Pi and would rather not to that. I haven't yet used dd to clone directly via the terminal, and just got RealVNC running on the Genmon Pi so haven't used the GUI utility there.

I have read that dd will not always produce a reliable clone, as doing this from a running OS may introduce inconsistencies, with code on the SD card changing while the system is running. But I also have read that the Debian Pi OS is written in such a fashion that very little change is made on the SD card while running in order to prolong the life of the SD card.

My questions are:

  1. Is this unreliable SD clone concern real when using dd in my environment?
  2. If producing a reliable SD clone is a concern, does this concern exist also for the GUI SD Card Copier, or have the developers put code into that utility to ensure that the clone is an exact copy at some point-in-time, much like backup applications on some other platforms? I am only interested in producing SD clones, not images that need to be restored.
  3. Any suggestions about what apps might be available to ensure this?

Many thanks!

DaveD44
  • 1
  • 1

2 Answers2

1

You've somehow missed the best backup solution available for RPi: image-backup (part of image-utils) will make a reliable backup of your RPi system while it is running.

dd should not be used to copy a live system. If you want to remove your SD card before running dd to copy it, that will work (although it will take a l-o-n-g time) - but don't use it on a live system.

So, there are already several answers here on SE re image-utils, and you can read them if you like. The answer I usually point people to is this one as it explains how to download and use the program.

Otherwise, you can get a copy from here:
https://forums.raspberrypi.com/viewtopic.php?t=332000&sid=58c9d2d90272e5ae96c12a58a30731d9

Or, from here:
https://github.com/seamusdemora/RonR-RPi-image-utils

Seamus
  • 21,900
  • 3
  • 33
  • 70
0

The SD Card copy utility is safe and reliable.

It works by formatting a fresh image on the card then performing a file by file copy (AFAIK ignoring virtual files).

There are image backup utilities which perform similar actions (using rsync) to an image file.

Both are safe because the OS is designed to safely copy files on a working system. If the Pi is heavily used it is possible files could be changed after copy so some may be missing - you certainly wouldn't perform an upgrade during backup. In my and many others experience both are reliable.

There are command line utilities to clone cards but I have never used one although if they follow the same technique should be safe.

Milliways
  • 59,890
  • 31
  • 101
  • 209