Chapter 12. Recovering and restoring a system


To back up and restore your system, Red Hat Enterprise Linux provides the Relax-and-Recover (ReaR) utility.

You can use ReaR as a disaster recovery solution and also for system migration.

By using ReaR, you can perform the following tasks:

  • Produce a system backup and a bootable image, and use the image to restore the system from an existing backup.
  • Replicate the original storage layout.
  • Restore user and system files.
  • Restore the system to different hardware.

Additionally, for disaster recovery, you can also integrate certain backup software with ReaR.

To create a rescue system, first install the packages for the Relax-and-Recover (ReaR) utility, adjust ReaR settings, and manually generate a system backup. This prepares your system for potential disaster recovery operations.

Prerequisites

  • The necessary configurations based on your backup restore plan are ready.

    Note

    The following steps use the NETFS backup method in example configurations. This method is fully-integrated and built-in with ReaR, and produces a backup in a location specified by the BACKUP_URL configuration setting. By default it uses the system tar utility to create a backup archive named backup.tar.gz.

  • You are using the Intel 64 or AMD64 (x86-64) hardware architecture, or the IBM POWER little-endian (ppc64le) architecture.

    If you are using the IBM Z architecture, see Using a ReaR rescue image on the 64-bit IBM Z architecture.

    On the 64-bit ARM architecture, ReaR is currently provided only as a Technology Preview in RHEL 9.7 and later.

Procedure

  1. Install the ReaR utility:

    # dnf install rear
  2. Modify the ReaR configuration file in an editor of your choice, for example:

    # vi /etc/rear/local.conf
    • Add the backup setting details to /etc/rear/local.conf. For example, in the case of the NETFS backup method, add the following lines:

      BACKUP=NETFS
      OUTPUT=ISO
      BACKUP_URL=<data-backup-location>
      OUTPUT_URL=<rescue-image-location>

      Replace <data-backup-location> with the location for the tar data backup, and <rescue-image-location> with the location for the rescue system ISO image. For example:

      BACKUP=NETFS
      OUTPUT=ISO
      
      # Backup is stored on an external drive
      BACKUP_URL=file:///run/media/user/external_drive/server_backups/
      
      # The ISO is stored on a dedicated NFS share
      OUTPUT_URL=nfs://backup-server.local/exports/rear/

      For further information on the syntax of the /etc/rear/local.conf file and for supported formats of BACKUP_URL and OUTPUT_URL, see the rear(8) man page.

      For a list of configuration variables that you can use in /etc/rear/local.conf, as well as their default values, see the /usr/share/rear/conf/default.conf file.

    • To configure ReaR to keep the previous backup archive when the new one is created, also add the following line to the configuration file:

      NETFS_KEEP_OLD_BACKUP_COPY=y
    • To make the backups incremental, meaning that only the changed files are backed up on each run, add the following line:

      BACKUP_TYPE=incremental
    • If you are planning to boot the ReaR rescue system on UEFI firmware, add the following line to ensure the boot does not fail:

      SECURE_BOOT_BOOTLOADER=/boot/efi/EFI/redhat/shimx64.efi

      If your system is using the 64-bit ARM architecture (aarch64), use the following line instead:

      SECURE_BOOT_BOOTLOADER=/boot/efi/EFI/redhat/shimaa64.efi
  3. Create a rescue system and data backup based on your restore plan. For example, when using the NETFS backup method, run the following command:

    # rear mkbackup
    1. If you need to create only the rescue system, use the rear mkrescue command instead
    2. If you need to create only the data backup, use the rear mkbackuponly command instead.
  4. Optional: Schedule regular automatic ReaR backup. You can use a variety of backup methods, based on your use case. For example:

    • Create a /etc/cron.d/rear crontab file, and add the following line:

      30 1 * * * /usr/sbin/rear mkbackup

      This runs the the rear mkbackup command at 1:30 AM every day, which creates a rescue system and a data backup in the location set up in the /etc/rear/local.conf file.

    • If you use an external backup method, schedule an external backup. The details depend on the backup method that you are using in ReaR.

Verification

  1. Burn the ISO image of the rescue system to a DVD, and attempt to use the DVD to boot.

    If this displays a Relax-and-Recover interface after booting, the rescue DVD works correctly.

  2. Use the ReaR interface to restore the system, and test that the restored system works.

To quickly recover and restore systems running on the IBM Z architecture, you can use the Relax-and-Recover (ReaR) rescue image.

ReaR provides basic functionality on the 64-bit IBM Z architecture and is fully supported in RHEL 9.2 and later. You can create a ReaR rescue image on IBM Z only in the z/VM environment. Backing up and recovering logical partitions (LPARs) is not supported.

Important

ReaR on the 64-bit IBM Z architecture is supported only with the rear package version 2.6-17.el9 or later. Earlier versions are available as a Technology Preview feature only. For more information about the support scope of Red Hat Technology Preview features, see https://access.redhat.com/support/offerings/techpreview.

The only output method currently available is Initial Program Load (IPL). IPL produces a kernel and an initial RAM disk (initrd) that can be used with the zIPL boot loader.

Procedure

  1. Install ReaR:

    # dnf install rear
  2. Add the following variables to the /etc/rear/local.conf file to configure ReaR for producing a rescue image on the 64-bit IBM Z architecture:

    1. To configure the IPL output method, add the`OUTPUT=IPL` line to the configuration.
    2. To configure the backup method and destination, add BACKUP and BACKUP_URL variables. For example:

      BACKUP=NETFS
      
      BACKUP_URL=nfs://<nfsserver name>/<share path>
      Important

      Local backup storage is currently not supported on the 64-bit IBM Z architecture.

    3. Optional: You can also configure the OUTPUT_URL variable to save the kernel and initrd files. By default, the OUTPUT_URL is aligned with BACKUP_URL.
  3. To perform backup and rescue image creation:

    # rear mkbackup

    This creates the kernel and initrd files at the location specified by the BACKUP_URL or OUTPUT_URL (if set) variable, and a backup using the specified backup method.

  4. To recover the system, use the ReaR kernel and initrd files created in the previous step, and boot from a Direct Attached Storage Device (DASD) or a Fibre Channel Protocol (FCP)-attached SCSI device prepared with the zipl boot loader, kernel, and initrd. For more information, see Booting the RHEL installation by using a prepared DASD.
  5. When the rescue kernel and initrd are booted, the ReaR rescue environment starts. Proceed with the system recovery.

12.3. Recovering your system by using ReaR

To recover your RHEL system on new hardware after a failure of the current hardware, use the Relax-and-Recover (ReaR) utility.

Prerequisites

  • You have set up ReaR and created a backup. For instructions, see Setting up ReaR and manually creating a backup.
  • You have a set of working hardware on which you want to run the system after you recover it.
  • The hard disk on which you plan to recover your system does not contain any critical data.

    Important

    Recovering a system on a hard disk by using ReaR erases all data currently stored on the disk.

Procedure

  1. Boot the rescue system on the new hardware. For example, you can burn the ISO image of the rescue system to a DVD, and boot from the DVD.
  2. In the Relax-and-Recover boot menu, select the option to boot to the recovery environment.
  3. In the RESCUE prompt, run the rear recover command.

    The rescue system recreates the partition layout and file systems.

  4. Restore user and system files from the data backup into the /mnt/local/ directory.

    For example, if you used the NETFS method to create the backup, ReaR automatically performs the restoration process. However, based on your backup settings, ReaR might still require your confirmation in certain points of the restoration.

12.4. Modifying the content of the ReaR backup

When creating a rescue system and data backup by using the Relax-and-Recover (ReaR) utility, certain files and storage components are not included in the backups. To adjust what data and devices are excluded from the backups, modify ReaR configuration.

When creating the rescue image, ReaR creates the /var/lib/rear/layout/disklayout.conf layout file, and embeds the file in the rescue image.

During the recovery process, ReaR uses the layout file to recreate the storage layout of the original system, where the rescue image has been produced, on the disks of the recovered system. The storage layout includes partitions, volume groups, logical volumes, file systems, and other storage components.

Prerequisites

Procedure

  1. Generate the current layout file.

    # rear savelayout
  2. Open the layout file to examine its configuration. For example:

    # vi /var/lib/rear/layout/disklayout.conf
  3. To exclude specific files or storage devices from the backup, you can configure ReaR to ignore them when creating the rescue image.

    1. Open the ReaR local configuration file for editing. For example:

      # vi /etc/rear/local.conf
    2. Adjust which storage devices will be excluded from the layout file. You can use a variety of exclude variables in the /etc/rear/local.conf file, including the following:

      • AUTOEXCLUDE_DISKS
      • AUTOEXCLUDE_MULTIPATH
      • AUTOEXCLUDE_PATH
      • EXCLUDE_RECREATE

      For information on the functions and syntax of these variables, as well as of the layout file, see the Layout configuration chapter in the ReaR user guide. This guide is installed with the rear package, and is available at /usr/share/doc/rear/relax-and-recover-user-guide.html.

    3. By default, when a local disk-based file system is included in the layout file, all files on that file system are backed up when you use the rear mkbackup or rear mkbackuponly commands.

      To configure specific files or a directory tree to be excluded from the backup, use the BACKUP_PROG_EXCLUDE variable.

      The value of BACKUP_PROG_EXCLUDE must be an array of glob(3)-style wildcard patterns that tar or rsync uses. Note that you must quote the patterns in order to prevent their expansion by the shell when it reads the configuration file.

      The default value of this variable is set in the /usr/share/rear/conf/default.conf file. The default value contains, for example, the /tmp/* pattern that excludes all the files and directories under the /tmp directory, but not the /tmp directory itself.

      If you need to exclude other files and directories, append further patterns to the variable. To ensure that the default values are preserved, do not override the variable.

      For example, to exclude all files and directories under the directory /data/temp, use:

      BACKUP_PROG_EXCLUDE+=( '/data/temp/*' )
      Note

      When you exclude all files and directories in a single mounted file system this way, ReaR recreates the file system during recovery, but it will be empty. You can use this for file systems that contain temporary data and do not require preserving, or for data that is backed up by using methods independent of ReaR.

Verification

  1. To ensure that the layout file includes only the required storage components, do the following:

    1. Re-generate the layout file.

      # rear savelayout
    2. Open the new layout file and make sure that your configuration changes had the intended effect.

      # vi /var/lib/rear/layout/disklayout.conf
  2. To ensure that the backup excludes specific files, use the rear mkbackup command. This lists the backup exclude patterns in the log.

    You can find the log file in the /var/log/rear directory. Use this to verify the exclude rules before performing a full system recovery. For example, the log can contain the following entries:

    2025-04-29 10:17:41.312431050 Making backup (using backup method NETFS)
    2025-04-29 10:17:41.314369109 Backup include list (backup-include.txt contents):
    2025-04-29 10:17:41.316197323   /
    2025-04-29 10:17:41.318052001 Backup exclude list (backup-exclude.txt contents):
    2025-04-29 10:17:41.319857125   /tmp/*
    2025-04-29 10:17:41.321644442   /dev/shm/*
    2025-04-29 10:17:41.323436363   /var/lib/rear/output/*

    In this example, the entire root file system is included in the backup, with the exception of all files and directories under the /tmp, /dev/shm and /var/lib/rear/output directories.

Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2026 Red Hat
Back to top