Raspberry Pi Restore

Hi,

I have urbackup backing up the entire rootfs of my Pi excluding “/proc;/sys;/run;/dev;/tmp;/var/tmp”. I’ve been reading the docs and doing some googling but I can’t seem to find a way I would go about restoring my entire rootfs to a new SD card.

What’s the best way I could go about restoring the rootfs to a SD card using another client, or is this kind of recovery not really support?

  • Setup a clean Linux somewhere (e.g. VM) and mount the sd card at e.g. /mnt/card Options:
    • Use a (clean, throwaway) VM
    • Use a e.g. raspbian and e.g. pivot_root to memory
    • Netboot the rpi
    • Boot the rpi from USB stick
    • Boot from second SD card and put the other SD card into a USB sd card reader
  • Download the client from the web interface for the Pi client as admin. This downloaded client contains the root keys to download the backups
  • Transfer the binary client to the restore Linux and install it
  • Wait for it to connect
  • Restore via urbackupclientctl restore-start --map-from / --map-to /mnt/card -b last if you have a boot partition something like urbackupclientctl restore-start --map-from / --map-to /mnt/card --map-from /boot --map-to /mnt/boot -b last

You can also try overriding the live running system like a maniac (perhaps after stopping all non-essential services) without the mapping etc., maybe it might work.

1 Like

Thanks for the reply, I thought the restore process may look a little like this.

USB boot seems like a good way to go about this. I assume it would be a good idea to stop the backups happening in the webui before starting this process, so the new installed client doesn’t backup and become the last backup :sweat_smile:

Not sure if I break any forum rules or anything but, this is what you want.
https://forums.raspberrypi.com/viewtopic.php?t=332000&hilit=image+utils
You run it on a running rpi, if you use the --initial tag it creates/backs up the fat32 boot partition, enables auto resizing of the sdcard if you burn the img file to a new sd-card (unless you disable it) and lets you decide how much extra space you want to add to the img file (so you can update the backup file incrementally with the same program even if you add a bunch of data in the future). All rsync options can be applied actually.
Essentially it loops the img file and mounts it, then rsync your whole sdcard (except /boot, stuff like /proc;/sys;/run;/dev;/tmp;/var/tmp and whatever you want to exclude).

I do this directly to a mouted network drive then backup the data on that drive with urbackup. No need to move sdcards or shutting down, just use the correct tools. :slight_smile:

Example:
sudo image-backup -i /mnt/backup/backup.img,,500 -o -vh,--info=progress2,--stats,--delete-excluded
will create backup.img with 500MB extra space to the img file, then you update the backup with:
sudo image-backup /mnt/backup/backup.img -o -vh,--info=progress2,--stats,--delete-excluded
Extremely fast and neat imho.