How to Install ReaR (Relax and Recover) on CentOS 7

| Reply More

ReaR Relax-and-Recover is a Linux bare metal disaster recovery and system migration solution. Relax and Recover (ReaR) is a true disaster recovery solution that creates recovery media from a running Linux system. If a hardware component fails, an administrator can boot the standby system with the ReaR rescue media and put the system back to its previous state. ReaR preserves the partitioning and formatting of the hard disk, the restoration of all data, and the boot loader configuration. ReaR is well suited as a migration tool, because the restoration does not have to take place on the same hardware as the original. It builds the rescue medium with all existing drivers, and the restored system adjusts automatically to the changed hardware.

ReaR even detects changed network cards, as well as different storage scenarios with their respective drivers (migrating IDE to SATA or SATA to CCISS) and modified disk layouts. Relax-and-Recover was designed to be easy to set up, requires no maintenance and is there to assist when disaster strikes. Its setup-and-forget nature removes any excuse for not having a disaster recovery solution implemented, so there is no excuse for not using it.


Relax-and-Recover is written entirely in Bash and does not require any external programs. However, the rescue system that is created by Relax-and-Recover requires some programs that are needed to make our rescue system work , that is 'mingetty' and 'sfdisk'. While all other required programs like sort, dd, grep, etc are already present in minimal installation.

Let's start with your system update using below command on your CentOS 7 server.

# yum -y update

Make sure the following dependencies is also installed on your system, else you will get its errors about missing packages.

# yum install syslinux syslinux-extlinux

syslinux extlinux

Install Relax-and-Recover

Many Linux distributions ship Relax-and-Recover as part of their distribution, you can refer to the Relax-and-Recover Download page to get its stable release.

Let run the below 'yum' command to download the rear package.

# yum install rear

The package will be installed after you type 'y' key to continue including its required dependencies.

install relax and recover

You can also start by cloning the Relax-and-Recover sources from Github with below command.

# git clone git://

Setup USB Media:

Prepare your USB media that Relax-and-Recover wil be using. Here we are using and external drive which is '/dev/sdb'. You can change '/dev/sdb' to the correct device in your situation.

Run the below command to format all data on that device.

# /usr/sbin/rear format /dev/sdb

Relax-and-recover asks you to confirm if you want to format the device or not, let's type 'Yes' and hit 'Enter'.

USB device /dev/sdb must be formatted with ext2/3/4 or btrfs file system
Please type Yes to format /dev/sdb in ext3 format: Yes

The device has been labeled REAR-000 by the format workflow. Now edit the '/etc/rear/local.conf' configuration file with below configuration.

# vim /etc/rear/local.conf

### write the rescue initramfs to USB and update the USB bootloader
#### create a backup using the internal NETFS method, using 'tar'
#### write both rescue image and backup to the device labeled REAR-000

Create Rescue Image:

Now you are ready to create a rescue image. Let's run the below command with (-v option) to see the verbose output .

# /usr/sbin/rear -v mkrescue

create rescue image

You might want to check the log file for possible errors or see what Relax-and-Recover is doing.

# tail -f /var/log/rear/rear-centos7.log

2016-05-16 00:19:52 Unmounting '/tmp/rear.Ir6gqwz2ROig9on/outputfs'
umount: /tmp/rear.Ir6gqwz2ROig9on/outputfs (/dev/sdb1) unmounted
rmdir: removing directory, '/tmp/rear.Ir6gqwz2ROig9on/outputfs'
2016-05-16 00:19:52 Finished running 'output' stage in 4 seconds
2016-05-16 00:19:52 Finished running mkrescue workflow
2016-05-16 00:19:52 Running exit tasks.
2016-05-16 00:19:52 Finished in 93 seconds
2016-05-16 00:19:52 Removing build area /tmp/rear.Ir6gqwz2ROig9on
rmdir: removing directory, '/tmp/rear.Ir6gqwz2ROig9on'
2016-05-16 00:19:53 End of program reached

Now reboot your system and try to boot from the USB device. If you are able to boot from your second drive then it mean your work is done. You can also check by mounting the other drive. Now let's dive into the advanced Relax-and-Recover options and start creating full backups.

# /usr/sbin/rear -v mkbackup

rear full backup

Rescue system:

Relax-and-Recover will not automatically add itself to the Grub bootloader. It copies itself to your /boot folder. To enable this, add below to your local configuration.


The entry in the bootloader is password protected. The default password is REAR. Change it in your own 'local.conf' file.


Storing on a central NFS server:

The most straightforward way to store your DR images is using a central NFS server. The configuration below will store both a backup and the rescue CD in a directory on the share.


Relax-and-Recover Configurations:

To configure Relax-and-Recover you have to edit the configuration files in '/etc/rear/' directory . All *.conf files are part of the configuration, but only 'site.conf' and 'local.conf' are intended for the user configuration. All other configuration files hold defaults for various distributions and should not be changed.

In almost all circumstances you have to configure two main settings and their parameters: The BACKUP method and the OUTPUT method.

The backup method defines, how your data was saved and whether Relax-and-Recover should backup your data as part of the mkrescue process or whether you use an external application, e.g. backup software to archive your data.

The output method defines how the rescue system is written to disk and how you plan to boot the failed computer from the rescue system. You can view in this file '/share/rear/conf/default.conf' for an overview of the possible methods and their options

Using Relax-and-Recover

To use Relax-and-Recover you always call the main script '/usr/sbin/rear' . To get the list of all its available commands that you can use. rune the below command.

# rear help

rear usage

To view/verify your configuration, run 'rear dump'. It will print out the current settings for BACKUP and OUTPUT methods and some system information.

# rear dump

To recover your system, start the computer from the rescue system and run rear recover. Your system will be recovered and you can restart it and continue to use it normally.


Relax-and-Recover (Rear) is the leading Open Source disaster recovery solution, and successor to mkcdrec. It was designed to be easy to set up and requires no maintenance and assists when disaster strikes. This was a detailed article on rear installation and its use case. Feel free to get back to us in case of any difficulty just leave us your comment or suggestions.


Share This :

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.