Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

Relax-and-Recover – Backup and Recover a Linux System - DesignLinux

May 29 2020
designlinux 0 Comments

Relax-and-Recover (ReaR in short) is a simple yet powerful, easy-to-setup, full-featured and leading open-source bare metal disaster recovery and system migration solution, written in Bash. It is a modular and configurable framework with numerous ready-to-use workflows for common situations.

ReaR creates a bootable rescue system and/or system backup in various formats. You can boot your bare metal server using the rescue system image and initiate a system restore from the backup. It can restore to different hardware where necessary, hence it can also be employed as a system migration tool.

Relax-and-Recover Key Features:

  1. It has a modular design written in Bash and can be extended using custom functionality.
  2. Supports various boot media including ISO, PXE, OBDR tape, USB or eSATA storage.
  3. Supports a variety of network protocols including FTP, SFTP, HTTP, NFS, and CIFS for storage and backup.
  4. Supports disk layout implementation such as LVM, DRBD, iSCSI, HWRAID (HP SmartArray), SWRAID, multipathing, and LUKS (encrypted partitions and filesystems).
  5. Supports both third-party and internal backup tools including IBM TSM, HP DataProtector, Symantec NetBackup, Bacula; tar and rsync.
  6. Supports booting via PXE, DVD/CD, bootable tape or virtual provisioning.
  7. Supports a simulation model that shows what scripts are run without executing them.
  8. Supports consistent logging and advanced debugging options for troubleshooting purposes.
  9. It can be integrated with monitoring tools such as Nagios and Opsview.
  10. It can also be integrated with job schedulers such as cron.
  11. It also supports various virtualization technologies supported (KVM, Xen, VMware).

In this article, you will learn how to install and configure ReaR to create a rescue system and/or system backup using a USB stick and rescue or restore a bare-metal Linux system after a disaster.

Step 1: Installing ReaR in Linux Bare Metal Server

1. To install the rear package on Debian and Ubuntu Linux distributions, use the following command.

$ sudo apt-get install rear extlinux

On RHEL and CentOS, you need to enable the EPEL 8 repository, then install the rear package as shown.

# yum install rear syslinux-extlinux grub2-efi-x64-modules
# dnf install rear syslinux-extlinux	#Fedora 22+

2. Once the installation is complete, rear’s main configuration directory is /etc/rear/ and the key configuration files are:

  • /etc/rear/local.conf – used to set system-specific configuration; it’s intended for manual configuration.
  • /etc/rear/site.conf – used to set site-specific configuration, should be created by the user.
  • /usr/share/rear/conf/default.conf – contains possible/default configuration values.
  • /var/log/rear/ – this directory stores the log files.

3. First, prepare the rescue media, a USB stick in this case by formatting using the rear command-line utility as follows. Once the formatting is complete, the media will be labeled as REAR-000.

# rear format /dev/sdb
Prepare Rescue Media

Prepare Rescue Media

4. To configure the output format, use the OUTPUT and OUTPUT_URL variables, enter it in the /etc/rear/local.conf configuration file.

OUTPUT=USB

4. Also, ReaR comes with a built-in backup method (called NETFS) which allows you to create both a rescue system and a full-system backup. It creates a simple backup as a tar archive by default.

To enable a full-system backup, add the BACKUP=NETFS and BACKUP_URL variables in the /etc/rear/local.conf configuration file. To create a bootable USB device, combine OUTPUT=USB and BACKUP_URL=”usb:///dev/disk/by-label/REAR-000” as shown.

OUTPUT=USB
BACKUP=NETFS
BACKUP_URL=”usb:///dev/disk/by-label/REAR-000”

5. After configuring the rear, run the following command to print out its current configuration for BACKUP and OUTPUT methods and some system information.

# rear dump
Rear Backup Configuration Settings

Rear Backup Configuration Settings

Step 2: Creating a Rescue System and a Full-System Backup

6. If all the settings are fine, you can create a rescue system using the mkrecue command as follows, where the -v option enables verbose mode.

# rear -v  mkrescue
Make Rescue System

Make Rescue System

Note: If you encounter the following error after running a rescue or backup operation, as shown in this screenshot.

UEFI systems: “ERROR: /dev/disk/by-label/REAR-EFI is not block device. Use `rear format -- --efi ' for correct format” 
USB Stick Format Error

USB Stick Format Error

Format the USB stick using this command and redo the operation.

# rear format  -- --efi /dev/sdb
Format USB

Format USB

7. To create a rescue system and backup the system as well, use the mkbackup command as shown.

# rear -v mkbackup

8. To create a full-system backup only, use the mkbackuponly command as follows.

# rear -v mkbackuponly

Optional: Scheduling Rear Operations Using Cron

8. You can schedule ReaR to regularly create a rescue system using the cron job scheduler by adding the appropriate entry in the /etc/crontab file.

minute hour day_of_month month day_of_week root /usr/sbin/rear mkrescue

The following configurations will create a rescue system or take a full-system backup every midnight. Ensure that your USB stick is attached to it.

0 		0   		*  		* 		root /usr/sbin/rear mkrescue
OR
0 		0   		*  		* 		root /usr/sbin/rear mkbackup

Step 3: Performing a System Rescue/Restoration

9. To restore/recover your system after a disaster, connect the bootable USB stick to your bare metal system and boot from it. In the console interface, select option one (Recover hostname) and click Enter.

ReaR Main Boot Menu

ReaR Main Boot Menu

10. Next, the ReaR rescue system will be configured, you may be prompted to provide replacements for the original network interfaces as shown in the screenshot. Once you are done, click Enter.

Select Network Interface

Select Network Interface

11. Then login as root (just type username root and click Enter) to run the actual recovery.

Run System Recovery

Run System Recovery

11. Next, run the following command to launch the recovery process. The rescue system will compare the disks, examine their configurations and prompt you to choose disk layout configuration. Press Enter to proceed with auto disk configuration.

Then it will start the system layout restoration, once the disk layout is created, it will restore the backup as shown in the following screenshot.

# rear recover
ReaR Recover Method

ReaR Recover Method

12. When the backup restoration is complete, the rescue system will run mkinitrd to create initial ramdisk images for preloading modules, then install the boot loader and exits. One the system recovery is done, the restored system will be mounted under /mnt/local/, move into this directory to examine it.

Finally, reboot the system:

# cd /mnt/local
# rebooot
Explore Restored System

Explore Restored System

13. After a reboot, the SELinux will try to relabel files and file systems on the recovered system based on /mnt/local/.autorelabel file, as shown in the following screenshot.

Relabeling File System

Relabeling File System

For more usage options, read the ReaR manual page.

# man rear

ReaR Homepage: http://relax-and-recover.org/.

The ReaR is the leading, easy-to-use (setup-and-forget) and open source bare metal disaster recovery and system migration framework. In this article, we explained how to use ReaR to create a Linux bare metal rescue system and backup and how to restore a system after a disaster. Use the comment form below share your thoughts with us.

Sharing is Caring…
Share on FacebookShare on TwitterShare on LinkedinShare on Reddit

Related

Tags: Linux Backup Tools, Linux Data Recovery Tools

How to Install Joomla on Ubuntu 18.04

Prev Post

How to Install OwnCloud on Ubuntu 18.04

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 649
  • 1,055,421

DesignLinux.com © All rights reserved

Go to mobile version