What is Relax and Recover(ReaR) and how can I use it for disaster recovery?
Environment
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
- Package: rear
Issue
- Red Hat Enterprise Linux now contains Relax and Recover(ReaR) which can be used for image based backups. What is it? Any example for using this backup utility?
Resolution
What's Relax and Recover
Relax-and-Recover(ReaR) is a recovery and system migration utility. The utility produces a bootable image and restores from backup using this image. It also allows to restore to different hardware and can therefore be used as a migration utility as well.
Rear package is now available for Red Hat Enterprise Linux:
- Red Hat Enterprise Linux 6 RHEA-2016-0850.
- Red Hat Enterprise Linux 7 RHEA-2015-2244.
How to set up ReaR to backup with NFS method
Before setting up ReaR, you need to make a backup-restore plan according to your environment. In this tutorial, we will:
- Set up an NFS server for holding the backup files.
- Back up the files to the NFS server and store the disaster recovery system to an ISO image.
- Boot the restore server with disaster recovery system and finish the recovery.
Detailed steps are as follows:
-
Create an export on the NFS server(in this example, it has the IP address 192.168.56.1). We use
/storagedirectory for storing the back up files later.# yum install nfs-utils # mkdir /storage # cat /etc/exports /storage *(fsid=0,rw,sync,no_root_squash,no_subtree_check,crossmnt) # service nfs start -
Install packages which are required for creating ISO image on the backup server.
# yum install rear genisoimage syslinux -
Modify the configuration file
/etc/rear/local.confon the backup server with these settings.# 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=Be careful when changing the
BACKUP_PROG_EXCLUDEvariable. Always preserve the default excludes to avoid issue described in solution RHEL 7 restored from ReaR doesn't boot if custom backup excludes were used for backup. -
Create the disaster recovery system and generate backup files.
# rear -d -v mkbackupRear will examine the current backup system and gather necessary information, like the disk layout, files to be excluded and the boot loader, etc. Then a bootable ISO image with disaster recovery system will be created under
/var/lib/rear/outputby default. At last the files to be backed up as well as the bootable ISO image will be transfered to the NFS server. -
Recovery test.
5.1 Burn the bootable ISO image to a CD or DVD.
5.2 Boot the test server from the recovery medium.
5.3 SelectRecover <hostname>. Here, thehostnameis the backup server's name.
5.4 Login as root without password.
5.5 Recover the backup to this test server:# rear -d -v recover5.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 starts from local harddisk.
TIPS:You can also choose theAutomatic Recover <hostname>to automate the recovery process, as long as no error occurs when you manually recover the test server. -
In case a disaster has occurred, you can proceed recovery steps as described in
Recovery testsection on a server which has been tested and has the same hardwares as the backup server.
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.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
