# Relax-and-Recover (ReaR)

RHEL 7.9 (Maipo)

# Setting up NFS server

・ Configuring NFS Server on Linux

# Installing ReaR

~]# yum install rear nfs-utils

・ Configuring Yum Repositories

# Configuring ReaR

ReaR is configured in the /etc/rear/local.conf file.

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

On a UEFI system, RHEL bootloaders need to be used by ReaR.

~]# [ /sys/firmware/efi ] && echo UEFI || echo BIOS
UEFI
~]# yum -y install grub2-efi-x64-modules
~]# cat >> /etc/rear/local.conf << EOF
UEFI_BOOTLOADER=/boot/efi/EFI/redhat/grubx64.efi
SECURE_BOOT_BOOTLOADER=/boot/efi/EFI/redhat/shimx64.efi
EOF

Ensure that NFS traffic is allowed through.

~]# firewall-cmd --permanent --add-service=nfs
~]# firewall-cmd --reload

# Creating Rescue Media and Backup System

~]# rear -d -v mkbackup
Relax-and-Recover 2.4 / Git
Using log file: /var/log/rear/rear-localhost.log
Using backup archive '/tmp/rear.tidkk4ynvLutuCB/outputfs/localhost/backup.tar.gz'
Creating disk layout
Using guessed bootloader 'GRUB' (found in first bytes on /dev/sda)
Creating root filesystem layout
Handling network interface 'ens192'
ens192 is a physical device
Handled network interface 'ens192'
To log into the recovery system via ssh set up /root/.ssh/authorized_keys or specify SSH_ROOT_PASSWORD
Copying logfile /var/log/rear/rear-localhost.log into initramfs as '/tmp/rear-localhost-partial-2026-05-19T15:35:39+0800.log'
Copying files and directories
Copying binaries and libraries
Copying kernel modules
Copying all files in /lib*/firmware/
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (273231843 bytes) in 38 seconds
Making ISO image
Wrote ISO image: /var/lib/rear/output/rear-localhost.iso (270M)
Copying resulting files to nfs location
Saving /var/log/rear/rear-localhost.log as rear-localhost.log to nfs location
Creating tar archive '/tmp/rear.tidkk4ynvLutuCB/outputfs/localhost/backup.tar.gz'
Archived 870 MiB [avg 6606 KiB/sec] OK
Archived 870 MiB in 136 seconds [avg 6557 KiB/sec]
Exiting rear mkbackup (PID 17951) and its descendant processes
Running exit tasks
You should also rm -Rf /tmp/rear.tidkk4ynvLutuCB
# On nfs server:
~]$ sudo ls -l /nfs/localhost/
total 1328764
-rw------- 1 root root 698335232 May 19 15:38 backup.tar.gz
-rw------- 1 root root       202 May 19 15:36 README
-rw------- 1 root root 282212352 May 19 15:36 rear-localhost.iso
-rw------- 1 root root    754860 May 19 15:36 rear-localhost.log
-rw------- 1 root root       278 May 19 15:36 VERSION

The localhost is hostname.

# Scheduling ReaR

~]# contab -e
0 22 * * 1-5 root /usr/sbin/rear mkbackup

# Performing Restore System

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

  2. Boot the server from the recovery medium.

  3. Select Recover. Here, the hostname is the client system's hostname.

  1. Login as root without password.

  2. Run the following command to restore the backup to this server:

~]# rear -d -v recover
  1. Reboot the server and start from the local hard disk.

# Reference

・ What is Relax and Recover(ReaR) and how to use it for disaster recovery?

Edited on