Preparing a System for Disaster Recovery with ReaR
ReaR (Relax-and-Recover) is a disaster recovery framework that helps system administrators re-create Linux infrastructure after a system failure. Using ReaR, you can create a bootable recovery system that re-creates the failed system's storage layout, restores files from a backup, and reinstalls the boot loader. To recover from a disaster as quickly as possible, prepare a disaster recovery system before the disaster happens and test it regularly on identical test hardware.
Prerequisites
Two systems: the machine to back up and an identical test machine. “Identical” in this context means that you can, for example, replace a network card with another one using the same kernel driver.
An internal backup tool, such as
tar, or a supported third-party backup tool.
1 What is ReaR? #
ReaR (Relax-and-Recover) is a disaster recovery framework designed to help system administrators re-create Linux infrastructure after a system failure. Using ReaR, you can create a bootable recovery system that re-creates the failed system's storage layout and restores files from a backup.
1.1 What is disaster recovery? #
A system in a production environment might be destroyed unexpectedly because of broken hardware, misconfiguration or software problems. Disaster recovery means re-creating the system, either on the same hardware or on identical replacement hardware. Re-creating a system involves not just restoring the system's files from a backup, but also preparing the system's storage layout (such as partitioning, file systems and mount points) and reinstalling the boot loader.
No disaster recovery solution works out-of-the-box. Therefore, you must prepare for a disaster before it happens.
1.2 What is a disaster recovery plan? #
Before a disaster happens, create a disaster recovery plan so that any system administrator knows exactly what to do and has a complete procedure to follow when the disaster happens.
- Risk analysis
Conduct a risk analysis of your infrastructure. List all the possible threats and evaluate how serious they are. Determine how likely these threats are and what their impact would be.
- Budget planning
The outcome of the analysis is an overview of which risks can be tolerated and which would be critical. Determine how you can minimize these risks and how much it costs to do so.
- Disaster recovery planning
Make checklists, test procedures, establish and assign priorities, and inventory your IT infrastructure. Define how to deal with problems if any services in your infrastructure fail.
- Disaster recovery testing
After defining a plan, test it thoroughly and regularly on hardware that is identical to your main IT infrastructure.
1.3 How does disaster recovery with ReaR work? #
ReaR uses Bash scripts to analyze a running system and create a disaster recovery system, which includes a recovery installer and either an integrated or external file backup. You must configure ReaR for your specific system and infrastructure, including what to back up, how to create and store the recovery system, and what the recovery installer does.
For the file backup, ReaR can use internal backup tools, such as tar or
rsync, or work with third-party backup tools. For a full list of supported
file backup methods, run man rear.
If the system is destroyed, you can boot the recovery installer from a physical medium or over the network. The recovery installer re-creates the system by preparing the storage layout (such as partitioning, file systems and mount points), restoring the files from the backup, and reinstalling the boot loader.
Test your disaster recovery system regularly to make sure it still works as expected. In particular, you should re-validate your disaster recovery system in the following cases:
When you upgrade your operating system to a new major or minor version.
When you update ReaR to a new version.
When you update any software that ReaR uses.
When you update low-level system components, such as
partedorbtrfs.
If a test fails, you might need to update the ReaR configuration and re-create the disaster recovery system.
1.4 Can I update ReaR? #
Version updates for ReaR are released in separate packages that intentionally conflict with each other. This prevents the installed version from being accidentally replaced with another version. If you have a tested and fully functional disaster recovery system with one version of ReaR, we recommend staying on that version.
However, if you do need to update ReaR, you can see which versions are available on the current version of your operating system by running the following command:
#zypper search --type package --verbose rear
You can find information about bug fixes, incompatibilities and other issues in the changelogs of the packages.
1.5 For more information #
2 Installing ReaR #
Install ReaR on the system you want to back up:
Log in as the
rootuser.Install ReaR:
To install the latest version of ReaR, run the following command:
#zypper install rearIf you need to install a specific version of ReaR, you can specify the package version. For example:
#zypper install rear29a
If your system boots with a UEFI boot loader, make sure the xorriso package is installed:
#zypper install xorrisoThis helper tool is used to create a UEFI-bootable ReaR recovery system ISO image.
3 Configuring ReaR #
To configure ReaR, edit the /etc/rear/local.conf file to define your
specific requirements, such as how to back up files and how to create and store the disaster
recovery system. This configuration is sufficient for most systems. To re-create a
non-standard system, you might also need to adjust the ReaR framework by editing the
Bash scripts in /usr/share/rear/.
Btrfs snapshot subvolumes can't be backed up and restored in their original state with file-based backup software.
Snapshot subvolumes on Btrfs file systems need almost no disk space because of Btrfs's copy-on-write functionality. However, file-based backup software backs up the snapshots as complete files, so they are included in the backup twice with their original file size. Therefore, the backed-up snapshots can't be restored to their original state.
ReaR is installed on the system you want to back up.
If your system boots with a UEFI boot loader, make sure the xorriso package is installed.
Perform this procedure on the system you want to back up:
Log in as the
rootuser.Copy the closest matching SUSE Linux example from the
/usr/share/rear/conf/examples/directory and paste it into/etc/rear/local.conf. Use this example as a starting point and adjust it for your specific system.Currently, the latest example file is
SLE12-SP2-btrfs-example.conf.All ReaR variables and their default values are explained in
/usr/share/rear/conf/default.conf. Examples of important variables are shown in the next steps:Configure your file backup method with
BACKUPand where to store the backup withBACKUP_URL. Use the following resources to learn more about configuring your backup method:For a list of supported
BACKUPmethods, seeman rear, section DESCRIPTION.For more information about
BACKUP_URL, seeman rear, section BACKUP SOFTWARE INTEGRATION.For more information about the additional options for each backup method, see the
/usr/share/rear/conf/default.conffile.
The following examples show some possible options:
Example 1: Using an NFS server to store the file backup #Make sure the backup directory on the NFS server has the right mount options. For example, you might need
no_root_squashbecause therear mkbackupcommand runs asroot. For more information, seeman exports.Configure ReaR to send the file backup to the NFS server:
BACKUP=NETFS BACKUP_URL=nfs://HOST.EXAMPLE.COM/PATH/TO/REAR/BACKUP
Example 2: Backing up Btrfs subvolumes withtar#Btrfs is set up with subvolumes, but
tarcreates backups with the--one-file-systemoption, which excludes subvolumes. Therefore, the mount points for the subvolumes must be explicitly included in the ReaR configuration. For example:BACKUP=NETFS BACKUP_URL=nfs://HOST.EXAMPLE.COM/PATH/TO/REAR/BACKUP BACKUP_PROG_INCLUDE=( /boot/grub2/i386-pc /boot/grub2/x86_64-efi /home /opt /root /srv /usr/local /var )
Tip: Mount points forBACKUP_PROG_INCLUDEYou can find the mount points for the subvolumes on your specific system by running the following command:
#findmnt -n -r -o TARGET -t btrfs | grep -v '^/$' | egrep -v 'snapshots|crash'Configure the boot method for the recovery system with
OUTPUTand, if necessary, where to store the recovery system withOUTPUT_URL. If you don't specify anOUTPUT_URL, ReaR stores the recovery system at the location defined by theBACKUP_URL. Use the following resources to learn more about configuring your boot method:For more information about
OUTPUTandOUTPUT_URL, seeman rear, section RESCUE IMAGE CONFIGURATION.For more information about the additional options for each boot method, see the
/usr/share/rear/conf/default.conffile.
The following examples show some possible options:
Example 3: Including the file backup in an ISO image #To save both the recovery system and the file backup to the same ISO image, you must use both
BACKUP_URLandOUTPUT_URL:OUTPUT=ISO BACKUP_URL=iso:///backup/ OUTPUT_URL=nfs://HOST.EXAMPLE.COM/PATH/TO/REAR/BACKUP
Example 4: Creating a UEFI-bootable ISO image #If your system boots with a UEFI boot loader, you must configure ReaR to use xorriso to create a UEFI-bootable ISO image:
OUTPUT=ISO ISO_MKISOFS_BIN="/usr/bin/xorrisofs"
If your system boots with UEFI Secure Boot, you must also add the following line:
SECURE_BOOT_BOOTLOADER="/boot/efi/EFI/sles/shim.efi"
Example 5: Saving the recovery system to a USB device #To use a USB device as the output, run the following command to format the device and label it
REAR-000:#rear format /PATH/TO/DEVICEConfigure ReaR to save the recovery system to a bootable USB device:
OUTPUT=USB BACKUP_URL=usb:///dev/disk/by-label/REAR-000
In SUSE Linux 16,
/etc/snapper/config-templatesmoved to/usr/share/snapper/config-templates. Change theCOPY_AS_ISline to use the new file path:COPY_AS_IS+=( /usr/lib/snapper/installation-helper /usr/share/snapper/config-templates )
If you have file systems on multipath devices, ReaR ignores them by default because it assumes they're on remote storage, not part of the local system. Add the following line to make ReaR include these file systems:
AUTOEXCLUDE_MULTIPATH=n
(Optional) If necessary, adjust the ReaR Bash scripts for your system's requirements.
Review the ReaR configuration:
#rear dumpThis command prints your ReaR configuration, taken from the default settings in
/usr/share/rear/conf/default.confand your specific settings in/etc/rear/local.conf.
4 Creating the recovery system #
Generate a ReaR recovery system. The recovery system includes a system-specific recovery installer and might include an internal file backup or reference an external file backup, depending on your backup solution.
debugscript mode might log secrets
This procedure uses debugscript mode to provide the most debugging
information, including logging commands and arguments in the ReaR log file. However,
be aware that secrets and sensitive information might also be logged. Make sure
you remove or obscure this information before sharing the log file.
ReaR is installed on the system you want to back up.
ReaR is configured in
/etc/rear/local.conf.If ReaR is configured to use an external storage medium like a USB device, make sure the device is available on the system you want to back up.
If your system boots with a UEFI boot loader, make sure the xorriso package is installed.
Perform this procedure on the system you want to back up:
Log in as the
rootuser.Create the recovery system, using the
-Doption to enabledebugscriptmode:For basic backups with
tar, use therear mkbackupcommand to create both the file backup and the recovery system:#rear -D mkbackupFor third-party backup tools, use the
rear mkrescuecommand to create only the recovery system:#rear -D mkrescue
Both commands perform the following steps:
Analyze the system and gather information, particularly about the boot loader and the disk layout, including partitioning, file systems, mount points, etc.
Create a bootable recovery system with the information gathered in the analysis.
The
rear mkbackupcommand also calls the internal backup tool to back up system files and user files. Therear mkrescuecommand doesn't create a backup of the files.If you used
rear mkrescue, create a file backup using your third-party backup tool.
If the command fails, find the issue by reviewing the command output and the log file at
/var/log/rear/. You might need to install a package or adjust the
ReaR configuration.
5 Testing the recovery system #
Whenever you create a disaster recovery system with ReaR, you must test it thoroughly on a test machine. The test machine must be able to serve as an identical replacement for the original machine if needed. We recommend testing the recovery system regularly to ensure everything works as expected.
You created a recovery system on the original machine.
The recovery system is available on a bootable recovery medium.
The test machine has identical hardware to the original machine.
The test storage is clean and as-new. This might mean never-used new storage or existing storage that is completely wiped. For more information, see https://en.opensuse.org/SDB:Disaster_Recovery#Prepare_replacement_hardware_for_disaster_recovery.
Perform this procedure on the test machine:
Boot the test machine from the recovery medium.
From the menu, select .
Log in as
root. No password is needed.Start the recovery installer, using the
-Doption to enabledebugscriptmode:#rear -D recoverThis command performs the following steps:
Restores the disk layout, including partitions, file systems and mount points.
Restores the system files and user files from the backup.
Restores the boot loader.
Important: Usingdebugscriptmode might log secretsUsing
debugscriptmode provides the most debugging information, including logging commands and arguments in the ReaR log file. However, secrets and sensitive information might also be logged. Make sure you remove or obscure this information before sharing the log file.After the recovery process is finished, reboot the system:
#rebootLog in to the restored system with the original credentials. Check whether the system was successfully re-created and can serve as a replacement for the original machine in the production environment.
When the test is finished, wipe the test storage so that it's ready for the next test or a disaster. Wiping a storage device can take a long time, so we recommend having clean replacement storage ready before a disaster happens so that you can recover as quickly as possible.
If the test fails, you might need to update the ReaR configuration and re-create the disaster recovery system.
6 Recovering from disaster #
After a disaster occurs, boot the ReaR recovery system and start the recovery installer on a machine with identical hardware to the original machine. The following procedure refers to this new machine as the replacement machine. Technically, the replacement machine could be a tested, identical machine that replaces the original machine, or it could be the original machine after replacing any broken hardware.
A recovery system was created on the original machine.
The recovery system is available on a bootable recovery medium.
The replacement machine has identical hardware to the original machine.
The replacement storage is clean and as-new. This might mean never-used new storage or existing storage that is completely wiped. For more information, see https://en.opensuse.org/SDB:Disaster_Recovery#Prepare_replacement_hardware_for_disaster_recovery.
Perform this procedure on the replacement machine:
If necessary, replace any broken hardware.
Boot the replacement machine from the recovery medium.
From the menu, select .
Log in as
root. No password is needed.Start the recovery installer, using the
-Doption to enabledebugscriptmode:#rear -D recoverThis command performs the following steps:
Restores the disk layout, including partitions, file systems and mount points.
Restores the system files and user files from the backup.
Restores the boot loader.
Important: Usingdebugscriptmode might log secretsUsing
debugscriptmode provides the most debugging information, including logging commands and arguments in the ReaR log file. However, secrets and sensitive information might also be logged. Make sure you remove or obscure this information before sharing the log file.After the recovery process is finished, reboot the system:
#rebootLog in to the restored system with the original credentials. Check whether the system was successfully re-created and can serve as a replacement for the original machine in the production environment.
If the checks are successful, add the replacement machine back to the production environment.
7 Legal Notice #
Copyright© 2006– 2026 SUSE LLC and contributors. All rights reserved.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled “GNU Free Documentation License”.
For SUSE trademarks, see https://www.suse.com/company/legal/. All other third-party trademarks are the property of their respective owners. Trademark symbols (®, ™ etc.) denote trademarks of SUSE and its affiliates. Asterisks (*) denote third-party trademarks.
All information found in this book has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither SUSE LLC, its affiliates, the authors, nor the translators shall be held liable for possible errors or the consequences thereof.