Chapter 34. Relax-and-Recover (ReaR)
- booting a rescue system on the new hardware
- replicating the original storage layout
- restoring user and system files
rear recover
command, which starts the recovery process. During this process, ReaR replicates the partition layout and filesystems, prompts for restoring user and system files from the backup created by backup software, and finally installs the boot loader. By default, the rescue system created by ReaR only restores the storage layout and the boot loader, but not the actual user and system files.
34.1. Basic ReaR Usage Copy linkLink copied to clipboard!
34.1.1. Installing ReaR Copy linkLink copied to clipboard!
yum install rear
~]# yum install rear
34.1.2. Configuring ReaR Copy linkLink copied to clipboard!
/etc/rear/local.conf
file. Specify the rescue system configuration by adding these lines:
OUTPUT=output format OUTPUT_URL=output location
OUTPUT=output format
OUTPUT_URL=output location
ISO
for an ISO disk image or USB
for a bootable USB.
file:///mnt/rescue_system/
for a local filesystem directory or sftp://backup:password@192.168.0.0/
for an SFTP directory.
Example 34.1. Configuring Rescue System Format and Location
/mnt/rescue_system/
directory, add these lines to the /etc/rear/local.conf
file:
OUTPUT=ISO OUTPUT_URL=file:///mnt/rescue_system/
OUTPUT=ISO
OUTPUT_URL=file:///mnt/rescue_system/
34.1.3. Creating a Rescue System Copy linkLink copied to clipboard!
/mnt/rescue_system/
. Because the system's host name is rhel-68
, the backup location now contains directory rhel-68/
with the rescue system and auxiliary files:
34.1.4. Scheduling ReaR Copy linkLink copied to clipboard!
/etc/crontab
file:
minute hour day_of_month month day_of_week root /usr/sbin/rear mkrescue
minute hour day_of_month month day_of_week root /usr/sbin/rear mkrescue
Example 34.2. Scheduling ReaR
/etc/crontab
file:
0 22 * * 1-5 root /usr/sbin/rear mkrescue
0 22 * * 1-5 root /usr/sbin/rear mkrescue
34.1.5. Performing a System Rescue Copy linkLink copied to clipboard!
- Boot the rescue system on the new hardware. For example, burn the ISO image to a DVD and boot from the DVD.
- In the console interface, select the "Recover" option:
- You are taken to the prompt:
Figure 34.2. Rescue system: prompt
Warning
Once you have started recovery in the next step, it probably cannot be undone and you may lose anything stored on the physical disks of the system. - Run the
rear recover
command to perform the restore or migration. The rescue system then recreates the partition layout and filesystems:Figure 34.3. Rescue system: running "rear recover"
- Restore user and system files from the backup into the
/mnt/local/
directory.Example 34.3. Restoring User and System Files
In this example, the backup file is a tar archive created per instructions in Section 34.2.1.1, “Configuring the Internal Backup Method”. First, copy the archive from its storage, then unpack the files into/mnt/local/
, then delete the archive:scp root@192.168.122.6:/srv/backup/rhel68/backup.tar.gz /mnt/local/ tar xf /mnt/local/backup.tar.gz -C /mnt/local/ rm -f /mnt/local/backup.tar.gz
~]# scp root@192.168.122.6:/srv/backup/rhel68/backup.tar.gz /mnt/local/ ~]# tar xf /mnt/local/backup.tar.gz -C /mnt/local/ ~]# rm -f /mnt/local/backup.tar.gz
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The new storage has to have enough space both for the archive and the extracted files. - Verify that the files have been restored:
ls /mnt/local/
~]# ls /mnt/local/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Figure 34.4. Rescue system: restoring user and system files from the backup
- Ensure that SELinux relabels the files on the next boot:
touch /mnt/local/.autorelabel
~]# touch /mnt/local/.autorelabel
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Otherwise you may be unable to log in the system, because the/etc/passwd
file may have the incorrect SELinux context. - Finish the recovery and reboot the system:
Figure 34.5. Rescue system: finishing recovery
ReaR will then reinstall the boot loader. Upon reboot, SELinux will relabel the whole filesystem.Then you will be able to log in to the recovered system.