Create a clone at the end of a backup
Note
This feature is available starting with raspiBackup version 0.7.3 and as of now in Beta
raspiBackup can restore a backup to a locally connected device immediately after creating it. This provides a so called cold backup that can be used right away to immediately restart a failed device or an OS that no longer boots by switching the boot medium. Without this feature, an existing backup must first be restored and this takes time. If the rsync backup type is used, the restore of current backup to the clone device is simply a synchronization with the backup and completes very quickly. A tar backup type always is a full restore of the backup and takes much longer.
Only the rsync and tar backup types, as well as both backup modes, are supported.
Note
In the following, the clone device is assumed to be
/dev/sda. Other examples would be/dev/mmcblk1or/dev/nvme1n1. Additionally, a PARTUUID of2a6bd249-01is assumed.
Steps to enable cloning:
-
Create a backup
-
Restore the backup to the clone device
/dev/sda -
List the PARTUUIDs of the clone device using
blkid | grep "/dev/sda"and select a PARTUUID. For example,2a6bd249-01. -
Enable cloning
-
Use the installer
In the installer, the
<clone device>and the PARTUUID should be configured onM3->C10. The PARTUUID has to be separated from the clone device by spaces.Note: The cloning device has to be connected to the system.
-
Manually edit the configuration file /usr/local/etc/raspiBackup.conf
In the
DEFAULT_CLONE_DEVICEoption, the clone device/dev/sdashould be specified and a PARTUUID should be configured in theDEFAULT_CLONE_PARTUUIDoption.
-
-
Creating a backup and a clone
-
Command line
At the command line, specify the option
--clone <clone device>when starting the backup.<clone device>refers to the locally connected device to which the current backup is to be synchronized or restored. In the example, it would be--clone /dev/sdaNote: A PARTUUID must have been configured beforehand.
-
Regular automatic invocation
If the installer is configured to run on a regular basis, a backup and a clone are automatically created at regular intervals.
-
Important
The following checks are performed to prevent accidental overwriting of other connected devices:
- The configuration variable
DEFAULT_CLONE_PARTUUIDmust match the PARTUUID of a partition on the cloned device.- The partitioning of the clone device must match the partitioning of the running system. The size of the last partition may differ.
Caution
In certain configurations, the Raspberry Pi may boot from the cloning device after a reboot. This can occur particularly when booting via USB from a USB hard drive or USB SSD and the cloning device is also connected via USB. Thorough testing is essential in such cases.
If you want to disable the creation of a clone, you must use the installer to delete the clone device and the PARTUUID at M3->C10, or do so manually in the configuration file.
Summary of key features related to cloning
- A clone must be initialized by restoring a backup. During this process, the clone device is assigned new PARTUUIDs, and
/etc/fstaband/boot/cmdline.txtare synchronized with the new PARTUUIDs. - When cloning, the clone device is not assigned new PARTUUIDs. Since
/etc/fstaband/boot/cmdline.txtrepeatedly receive the system’s PARTUUIDs, the PARTUUIDs are continuously synchronized with those of the clone device. - During cloning,
DEFAULT_CLONE_PARTUUIDmust contain a PARTUUID of a clone partition to prevent accidentally overwriting the wrong device. Additionally, the partitioning of the clone device must match the partitioning of the system (number and size). The last partition may be smaller or larger.