Making backups regularly is one of the most relevant tasks for a Linux user. In this new part of the series ‘Backup methods’, I will show you how to use Relax-and-Recover (ReaR).

Relax-and-Recover (ReaR) is a “Linux bare metal disaster recovery solution”. It allows you to create a rescue system which can restore the partition layout and the bootloader. You can use another program for backing up user and system files or you can configure ReaR to do it.

  1. Install rear.
  2. Open /etc/rear/local.conf and edit the following lines:
    # Output format for the rescue system (ISO or USB)
    OUTPUT=ISO
    # Output location for the rescue system
    OUTPUT_URL=file:///mnt/rescue_system/
    
  3. To create the rescue system, run (as root or using sudo):
    rear mkrescue
    
  4. Then, you can transfer the rescue system to an external medium and boot it on the new hardware (make sure you only have the target disk installed on the system, it will make the process easier). ReaR boot menu
  5. Select the “Recover” option. Once the startup configuration is done, it will show a user prompt: type root and press Enter. ReaR login window
  6. To replicate the partition table on the target disk, type rear recover. ReaR recover partition table
  7. When this process is finished, you will be able to copy system files to the mount point specified in the command line (/mnt/local). You can use several methods like SSH (using scp) or by attaching a USB or hard drive.
  8. When you finished, type exit and ReaR will install the bootloader.

Back up system files with ReaR

  1. ReaR has a built-in backup method you can configure by editing /etc/rear/local.conf and adding these lines:
    BACKUP=NETFS
    # Output location for the backup
    BACKUP_URL=file:///srv/recoverbackup/
    
    • In order to make a backup of your system files, you need to mount an external drive or USB and specify this mount point in the config file.
  2. Then, you can run rear mkbackuponly to only create the backup, or rear mkbackup to create the rescue system and the backup.
  3. When using the rescue system, before running rear recover, copy backup file (backup.tar.gz) to the directory specified in BACKUP_URL.