Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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/mmcblk1 or /dev/nvme1n1. Additionally, a PARTUUID of 2a6bd249-01 is assumed.

Steps to enable cloning:

  1. Create a backup

  2. Restore the backup to the clone device /dev/sda

  3. List the PARTUUIDs of the clone device using blkid | grep "/dev/sda" and select a PARTUUID. For example, 2a6bd249-01.

  4. Enable cloning

    1. Use the installer

      In the installer, the <clone device> and the PARTUUID should be configured on M3->C10. The PARTUUID has to be separated from the clone device by spaces.

      Note: The cloning device has to be connected to the system.

    2. Manually edit the configuration file /usr/local/etc/raspiBackup.conf

      In the DEFAULT_CLONE_DEVICE option, the clone device /dev/sda should be specified and a PARTUUID should be configured in the DEFAULT_CLONE_PARTUUID option.

  5. Creating a backup and a clone

    1. 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/sda

      Note: A PARTUUID must have been configured beforehand.

    2. 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:

  1. The configuration variable DEFAULT_CLONE_PARTUUID must match the PARTUUID of a partition on the cloned device.
  2. 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.

  1. A clone must be initialized by restoring a backup. During this process, the clone device is assigned new PARTUUIDs, and /etc/fstab and /boot/cmdline.txt are synchronized with the new PARTUUIDs.
  2. When cloning, the clone device is not assigned new PARTUUIDs. Since /etc/fstab and /boot/cmdline.txt repeatedly receive the system’s PARTUUIDs, the PARTUUIDs are continuously synchronized with those of the clone device.
  3. During cloning, DEFAULT_CLONE_PARTUUID must 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.