framps / raspiBackup

Create and keep multiple backup versions of your running Raspberries
https://raspibackup.linux-tips-and-tricks.de
GNU General Public License v3.0
826 stars 75 forks source link

Add clone feature #730

Closed framps closed 6 months ago

framps commented 10 months ago

Right now raspiBackup doesn't support to clone a running system on another device do have a ready to go backup handy.

Actually it's possible to create a backup and immediately restore this backup to a device. But this doubles the clone time and if somebody just wants to create a clone there is no backup required.

There exists already a helper script which creates a dd file from a backup. This is usually used by Windows folks because they then can use Windows tools to restore the backup. It shouldn't be a big deal to update this script to restore the backup directly to a device.

But it's much more convenient to have a direct clone feature available in raspiBackup.

framps commented 10 months ago

Two new options: --clone and --cloneUpdate will be added: First one initializes the device partitions and then copies the partitions with rsync and the second one just syncs the device partitions with rsync. -d defines the target device.

framps commented 9 months ago

Instead to create a clone directly by raspiBackup raspiBackupRestore2Image allows now to restore a backup created by raspiBackup onto another SD card. Just execute raspiBackup followed by raspiBackupRestore2Image.

framps commented 9 months ago

Just created raspiBackupAndClone helper script which creates a backup and restores the just created backup on any device.

framps commented 8 months ago

To check whether it's feasible and maintainable to add the supported clone feature in raspiBackup I created a prototype branch m_clone. It looks promising. Right now a clone booted successfully :-D

framps commented 8 months ago

I spent the last week to finish the clone support prototype in raspiBackup :wink:

Execute following instructions to install raspiBackup and grab the clone prototype:

curl -s https://raw.githubusercontent.com/framps/raspiBackup/master/scripts/raspiBackupDownloadFromGit.sh | bash -s -- m_clone installation/raspiBackupInstallUI.sh

sudo bash ./raspiBackupInstallUI.sh 

M2 -> I1 
M3 -> C4 -> Clone to another device -> exit

curl -s https://raw.githubusercontent.com/framps/raspiBackup/master/scripts/raspiBackupDownloadFromGit.sh | bash -s -- m_clone raspiBackup.sh

sudo ./raspiBackup.sh -t cloneinit -d <targetDevice> # e.g. /dev/sda or /dev/mmcblk0 or /dev/nvme0n1
sudo ./raspiBackup.sh -t clone -d <targetDevice> # e.g. /dev/sda or /dev/mmcblk0 or /dev/nvme0n1

Please report any issues, questions and feedback in this issue.

framps commented 8 months ago

Given there is no feedback this issue is closed.

framps commented 8 months ago

Mixed mode clone fails (/boot on sd card and /root on USB)

framps commented 6 months ago

The prototype works perfect but it's a kind of hack because raspiBackup doesn't support from a design perspective cloning. Therefor this feature will not be added to raspiBackup.