What is Relax and Recover(ReaR) and how to use it for disaster recovery?
Environment
- Red Hat Enterprise Linux 10
- Red Hat Enterprise Linux 9
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 6
- Packages:
rearnfs-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 restoration 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 10
- 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 ?
A backup and restore plan suited to the system environment must be in place before configuring ReaR. This tutorial includes:
- Set up an
NFSsystem for holding the backup files. - Back up the client system's files to the
NFSsystem and store the disaster recovery system in an ISO image. - Boot the client system with the disaster recovery ISO and perform a system recovery.
The detailed steps are as follows:
-
Take the following steps on the
NFSsystem:1.1. Install the
nfs-utilspackage.# yum install nfs-utils1.2. Create and export a directory on the
NFSsystem. 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
NFSserver.RHEL 6:
# service nfs startRHEL 7 and later:
# systemctl start nfs-server1.4. If a firewall is running on the system, ensure that NFS traffic is allowed through.
-
Take the following steps on the client system intended for backup:
2.1. Install the
rearandnfs-utilspackages.# yum install rear nfs-utils2.2. Modify the
/etc/rear/local.confconfiguration 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_EXCLUDEvariable. Always preserve the default excludes to avoid the issue described in the solution article RHEL 7 restored fromReaRdoesn't boot if custom backup excludes were used for backup.On a
UEFIsystem, 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.efi2.3. If a firewall is running on the system, ensure that NFS traffic is allowed through.
2.4. Run the following command to generate the disaster recovery system and backup files:
# rear -d -v mkbackupNOTE:
ReaRwill 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/outputdirectory by default. At last, the files to be backed up as well as the bootable ISO image will be transferred to theNFSserver. -
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, thehostnameis the client system's hostname.3.4. Login as
rootwithout password.3.5. Run the following command to restore the backup to this test server:
# rear -d -v recover3.6. After restoring the backup, it may be useful to remain in the shell of the disaster recovery system to verify the recreation on the test server. If everything appears to be in order, reboot the test server and start from the local hard disk.
TIP: The
Automatic Recover <hostname>option can also be used to automate the recovery process, provided no errors occur during manual recovery of 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