What is Relax and Recover(ReaR) and how can I use it for disaster recovery?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 6
  • Packages: rear nfs-utils

Issue

  • Red Hat Enterprise Linux now contains Relax and Recover (ReaR) which can be used for image based backups. What is it? Any examples for using this backup utility?

Resolution

What's Relax and Recover(ReaR)

Relax-and-Recover(ReaR) is a disaster recovery tool. The utility produces a bootable image and restores from backup using this image. While it may allow you to restore to different hardware, this is NOT supported due to several factors that can cause failure during the restoration. (For example, disk size/type, BIOS/EFI platform, specific required drivers, etc.)

ReaR is available for Red Hat Enterprise Linux (RHEL):
- Red Hat Enterprise Linux 9
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 6

Support Note: Support of ReaR with RHEL is intended for the image based recovery capabilities. While the package includes all of the upstream capabilities, please note that there are many options that are not well tested.

How to set up ReaR to backup with NFS method

Before setting up ReaR, you need to make a backup/restore plan suited to your environment. In this tutorial, we will:

  • Set up an NFS system for holding the backup files.
  • Back up the files of a client system to the NFS system and store the disaster recovery system on an ISO image.
  • Boot the client system with the disaster recovery system and perform a system recovery.

The detailed steps are as follows:

  1. Take the following steps on the NFS system.

    1.1. Install the nfs-utils package.

    # yum install nfs-utils
    

    1.2. Create and export a directory on the NFS system. In this example, /storage is the exported directory.

    # mkdir /storage
    
    # cat /etc/exports
    /storage        *(fsid=0,rw,sync,no_root_squash,no_subtree_check,crossmnt)
    

    1.3. Start NFS server.

    RHEL 6:

    # service nfs start 
    

    RHEL 7 and later:

    # systemctl start nfs-server
    

    1.4. If you have a firewall running on this system, make sure to allow nfs traffic through.

  2. Take the following steps on the client system that you intend to backup.

    2.1. Install the rear and nfs-utils packages.

    # yum install rear nfs-utils
    

    2.2. Modify the /etc/rear/local.conf configuration file on the client system to reflect the following settings. In this example, the local IP address 192.168.56.1 represents the NFS system.

    # cat /etc/rear/local.conf
    OUTPUT=ISO
    OUTPUT_URL=nfs://192.168.56.1/storage
    BACKUP=NETFS
    BACKUP_URL=nfs://192.168.56.1/storage
    BACKUP_PROG_EXCLUDE=("${BACKUP_PROG_EXCLUDE[@]}" '/media' '/var/tmp' '/var/crash')
    NETFS_KEEP_OLD_BACKUP_COPY=
    

    NOTE: Be careful when changing the BACKUP_PROG_EXCLUDE variable. Always preserve the default excludes to avoid the issue described in the solution article RHEL 7 restored from ReaR doesn't boot if custom backup excludes were used for backup.

    On a UEFI system, RHEL bootloaders need to be used by ReaR. Add the following to /etc/rear/local.conf.

    UEFI_BOOTLOADER=/boot/efi/EFI/redhat/grubx64.efi
    SECURE_BOOT_BOOTLOADER=/boot/efi/EFI/redhat/shimx64.efi
    

    2.3. If you have a firewall running on this system, make sure to allow nfs traffic through.

    2.4. Run the following command to generate the disaster recovery system and backup files.

    # rear -d -v mkbackup
    

    NOTE: ReaR will examine the system and gather the necessary information; like the disk layout, files to be excluded, the boot loader, etc. Then, a bootable ISO image with a disaster recovery system will be created under the /var/lib/rear/output directory by default. At last, the files to be backed up as well as the bootable ISO image will be transferred to the NFS server.

  3. Test the backup on a test system.

    3.1. Burn the bootable ISO image to a CD or DVD.

    3.2. Boot the test server from the recovery medium.

    3.3. Select Recover <hostname>. Here, the hostname is the client system's name.

    3.4. Login as root without password.

    3.5. Run the following command to restore the backup to this test server:

    # rear -d -v recover
    

    3.6. After restoring the backup, you may choose to stay in the shell of the disaster recovery system to check the recreation on the test server. If everything is okay, reboot the test server and start from the local hard disk.

    TIP: You can also choose the Automatic Recover <hostname> to automate the recovery process, as long as no error occurs when you manually recover the test system.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments