= rear(8)
:version: v2.4
:date: 20 June 2018
:data-uri:
:doctype: manpage
:lang: en
:quirks:


== NAME
rear - bare metal disaster recovery and system migration tool


== SYNOPSIS
*rear* [*-h*|*--help*] [*-V*|*--version*] [*-dsSv*] [*-D*|*--debugscripts* _SET_] [*-c* _DIR_] [*-C* _CONFIG_] [*-r* _KERNEL_] [--] _COMMAND_ [_ARGS_...]


== DESCRIPTION
Relax-and-Recover is the leading Open Source disaster recovery solution. It
is a modular framework with many ready-to-go workflows for common situations.

Relax-and-Recover produces a bootable image. This image can repartition the
system. Once that is done it initiates a restore from backup. Restores to
different hardware are possible. Relax-and-Recover can therefore be used as a
migration tool as well.

Currently Relax-and-Recover supports various boot media (incl. ISO, PXE,
OBDR tape, USB or eSATA storage), a variety of network protocols (incl.
sftp, ftp, http, nfs, cifs) for storage and backup as well as a multitude
of backup strategies (incl.  IBM Tivoli Storage Manager, HP DataProtector,
Symantec NetBackup, EMC NetWorker, EMC Avamar, FDR/Upstream, NovaBACKUP DC, Bareos,
Bacula, rsync, rbme, Borg). This results in a bootable image that is capable of
booting via PXE, DVD/CD, bootable tape or virtual provisioning.

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 excuses for not having a disaster recovery solution implemented.

Recovering from disaster is made very straight-forward by a 2-step recovery
process so that it can be executed by operational teams when required.
When used interactively (e.g. when used for migrating systems), menus help
make decisions to restore to a new (hardware) environment.

Extending Relax-and-Recover is made possible by its modular framework.
Consistent logging and optionally extended output help understand the concepts
behind Relax-and-Recover and help debug during development.

Relax-and-Recover comes with ABSOLUTELY NO WARRANTY; for details see
the GNU General Public License at: http://www.gnu.org/licenses/gpl.html


== OPTIONS

=== GLOBAL OPTIONS

-h --help::
    usage information

-c DIR::
    alternative config directory; instead of /etc/rear

 -C CONFIG::
    additional config file; absolute path or relative to config directory

-d::
    *debug mode* (log debug messages to log file - also sets -v)

-D::
    *debugscript mode* (log executed commands via 'set -x' - also sets -v and -d)

--debugscripts SET::
    same as -d -v -D but *debugscript mode* with 'set -SET'

-r KERNEL::
    kernel version to use (by default use running kernel)

-s::
    *simulation mode* (show what scripts are run without executing them)

-S::
    *step-by-step mode* (acknowledge each script individually)

-v::
    *verbose mode* (show more output and run many commands in verbose mode)

-V --version::
    version information

=== COMMANDS

*checklayout*::
    check if the disk layout has changed since the last run of
    mkbackup/mkrescue

*dump*::
    dump configuration and system information; please run this to verify
    your setup

*format*::
    format and label USB or tape media to be used with rear;
    +
    first argument is the USB or tape device to use, eg. _/dev/sdX_ or
    _/dev/stX_

*help*::
    print full list of commands and options

*mkbackup*::
    create rescue media and backup the system (only for internal backup
    methods)

*mkbackuponly*::
    backup the system (only for internal backup methods) without creating
    rescue media

*mkrescue*::
    create rescue media only

*recover*::
    recover the system; can be used only when running from the rescue media

*restoreonly*::
    only restore the backup; can be used only when running from the rescue media

*mkopalpba*::
    create a pre-boot authentication (PBA) image to boot from TCG Opal 2-compliant self-encrypting disks

*opaladmin*::
    administrate TCG Opal 2-compliant self-encrypting disks

*validate*::
    submit validation information

Use 'rear -v help' for more advanced commands.


== BACKGROUND INFORMATION
The process of bare metal disaster recovery consists of two parts:

 - Recreate the system layout
 - Restore the data to the system

Most backup software solutions are very good at restoring data but do not
support recreating the system layout. Relax-and-Recover is very good at
recreating the system layout but works best when used together with
supported backup software.

In this combination Relax-and-Recover recreates the system layout and calls
the backup software to restore the actual data. Thus there is no unnecessary
duplicate data storage and the Relax-and-Recover rescue media can be very small.

For demonstration and special use purposes Relax-and-Recover also includes
an internal backup method, NETFS, which can be used to create a simple tar.gz
archive of the system. For all permanent setups we recommend using something
more professional for backup, either a traditional backup software (open
source or commercial) or rsync with hardlink based solutions, e.g. RSYNC
BACKUP MADE EASY.

== RESCUE IMAGE CONFIGURATION
The +OUTPUT+ variable defines from where our bootable rescue image will be
booted and the +OUTPUT_URL+ variable defines where the rescue image should be
send to. Possible +OUTPUT+ settings are:

OUTPUT=*RAMDISK*::
Create only the Relax-and-Recover initramfs.

OUTPUT=*ISO*::
*(Default)* Create a bootable ISO9660 image on disk as _rear-$(hostname).iso_

OUTPUT=*PXE*::
Create on a remote PXE/NFS server the required files (such as
configuration file, kernel and initrd image

OUTPUT=*OBDR*::
Create a bootable OBDR tape (optionally including the backup archive).
Specify the OBDR tape device by using +TAPE_DEVICE+.

OUTPUT=*USB*::
Create a bootable USB disk (using extlinux). Specify the USB storage
device by using +USB_DEVICE+.

OUTPUT=*RAWDISK*::
Create a bootable image file named "rear-$(hostname).raw.gz", which

* supports UEFI boot if syslinux/EFI or Grub 2/EFI is installed,
* supports Legacy BIOS boot if syslinux is installed,
* supports UEFI/Legacy BIOS dual boot if syslinux *and* one of the supported EFI
  bootloaders are installed.

When using +OUTPUT=ISO+, +RAMDISK+, +OBDR+, +USB+, or +RAWDISK+ you should
provide the backup target location through the +OUTPUT_URL+ variable. Possible
+OUTPUT_URL+ settings are:

OUTPUT_URL=*file://*::
Write the image to disk. The default is in _/var/lib/rear/output/_.

OUTPUT_URL=*nfs://*::
Write the image by mounting the target filesystem via NFS.

OUTPUT_URL=*cifs://*::
Write the image by mounting the target filesystem via CIFS.

OUTPUT_URL=*fish://*::
Write the image using +lftp+ and the FISH protocol.

OUTPUT_URL=*ftp://*::
Write the image using +lftp+ and the FTP protocol.

OUTPUT_URL=*ftps://*::
Write the image using +lftp+ and the FTPS protocol.

OUTPUT_URL=*hftp://*::
Write the image using +lftp+ and the HFTP protocol.

OUTPUT_URL=*http://*::
Write the image using +lftp+ and the HTTP (PUT) procotol.

OUTPUT_URL=*https://*::
Write the image using +lftp+ and the HTTPS (PUT) protocol.

OUTPUT_URL=*sftp://*::
Write the image using +lftp+ and the secure FTP (SFTP) protocol.

OUTPUT_URL=*rsync://*::
Write the image using +rsync+ and the RSYNC protocol.

OUTPUT_URL=*sshfs://*::
Write the image using sshfs and the SSH protocol.

OUTPUT_URL=*null*::
Do not copy the rescue image from _/var/lib/rear/output/_ to a remote output location.
+OUTPUT_URL=null+ is useful when another program (e.g. an _external_ backup program)
is used to save the rescue image from the local system to a remote place,
or with +BACKUP_URL=iso:///backup+ when the backup is included in the rescue image
to avoid a (big) copy of the rescue image at a remote output location.
In the latter case the rescue image must be manually saved from the local system to a remote place.
+OUTPUT_URL=null+ is only supported together with +BACKUP=NETFS+.

If you do not specify +OUTPUT_URL+ variable then by default it will be aligned to what
was defined by variable +BACKUP_URL+. And, the rescue image will then be copied to the same
location as your backup of the system disk(s).

The +ISO_DEFAULT+ variable defines what default boot option is used on the rescue image.
Possible values are `manual`, `boothd` or `automatic`. Manual will make you boot into
the shell directly by default, boothd will boot to the first disk (default) or automatic
will automatically start in recovery mode.

== RESCUE IMAGE KERNEL COMMAND LINE OPTIONS
When booting the rescue image you can edit the kernel command line.
There are some Relax-and-Recover specific kernel command line options:

*debug*::
The rescue system start up scripts in /etc/scripts/system-setup.d/
are run one by one each one after pressing 'Enter' and
the scripts are run with 'set -x' which prints commands
and their arguments as they are executed.

*auto_recover* or *automatic*::
Launch 'rear recover' automatically (without automated reboot).
Together with 'debug' it runs 'rear recover' in debug mode.

*unattended*::
Launch 'rear recover' automatically as with 'auto_recover'
plus automated reboot after successful 'rear recover'.

*ip= nm= netdev= gw=*::
If IP address plus optionally netmask (default 255.255.255.0),
network device (default eth0), and a default gateway are specified
only that single network device is set up. Example:
----
ip=192.168.100.2 nm=255.255.255.0 netdev=eth0 gw=192.168.100.1
----

*noip*::
Skip network devices setup by the rescue system start up scripts (overrides ip= nm= netdev= gw=).

== BACKUP SOFTWARE INTEGRATION
Currently Relax-and-Recover supports the following backup methods. Please
distinguish carefully between Relax-and-Recover support for 3rd party
backup software and Relax-and-Recover internal backup methods. The latter
also creates a backup of your data while the former will only integrate
Relax-and-Recover with the backup software to restore the data with the
help of the backup software without actually creating backups. This means
that for all non-internal backup software you *must* take care of creating
backups yourself (unless otherwise noted).

Especially the +rear mkbackup+ command can be confusing as it is only
useful for the internal backup methods and has usually no function at all with
the other (external) backup methods.

The following backup methods need to
be set in Relax-and-Recover with the +BACKUP+ option. As mentioned we have
two types of +BACKUP+ methods - _internal_ and _external_.

The following +BACKUP+ methods are _external_ of Relax-and-Recover meaning
that usually you are responsible of backups being made:

BACKUP=*REQUESTRESTORE*::
*(default)* Not really a backup method at all, Relax-and-Recover simply
halts the recovery and requests that somebody will restore the data
to the appropriate location (e.g. via SSH). This method works especially
well with an rsync based backup that is pushed back to the backup
client.

BACKUP=*EXTERNAL*::
Internal backup method that uses an arbitrary external command to
create a backup and restore the data.

BACKUP=*DP*::
Use HP Data Protector to restore the data.

BACKUP=*FDRUPSTREAM*::
Use FDR/Upstream to restore the data.

BACKUP=*GALAXY*::
Use CommVault Galaxy 5 to restore the data.

BACKUP=*GALAXY7*::
Use CommVault Galaxy 7 to restore the data.

BACKUP=*GALAXY10*::
Use CommVault Galaxy 10 (or Simpana 10) to restore the data.

BACKUP=*NBU*::
Use Symantec NetBackup to restore the data.

BACKUP=*TSM*::
Use IBM Tivoli Storage Manager to restore the data. The Relax-and-Recover
result files (e.g. ISO image) are also saved into TSM.
There is a (currently experimental) first draft implementation
that a TSM backup is created by calling 'dsmc incremental' during 'rear mkbackup'.

BACKUP=*NSR*::
Using EMC NetWorker (Legato) to restore the data.

BACKUP=*AVA*::
Using EMC Avamar to restore the data.

BACKUP=*SESAM*::
Using SEP Sesam to restore the data.

BACKUP=*NBKDC*::
Using Novastor NovaBACKUP DC to restore the data.

BACKUP=*RBME*::
Use Rsync Backup Made Easy (rbme) to restore the data.

BACKUP=*BAREOS*::
Use Open Source backup solution BAREOS (a fork a BACULA) to restore the data.

BACKUP=*BACULA*::
Use Open Source backup solution BACULA to restore the data.

BACKUP=*DUPLICITY*::
Use encrypted bandwidth-efficient backup solution using the rsync algorithm to restore the data.

BACKUP=*BORG*::
Use BorgBackup (short Borg) a deduplicating backup program to restore the data.
Executing 'rear mkbackup' will create a Borg backup,
see the section 'ReaR with Borg back end' in the ReaR user-guide 'Scenarios' documentation.

The following +BACKUP+ methods are _internal_ of Relax-and-Recover:

BACKUP=*NETFS*::
Internal backup method which can be used to create a simple backup
(tar archive).

BACKUP=*RSYNC*::
Use rsync to restore data.


If your favourite backup software is missing from this list, please submit
a patch or ask us to implement it for you.

When using +BACKUP=NETFS+ you must provide the backup target location
through the +BACKUP_URL+ variable. Possible +BACKUP_URL+ settings are:


BACKUP_URL=*file://*::
To backup to local disk, use +BACKUP_URL=file:///directory/path/+

BACKUP_URL=*nfs://*::
To backup to NFS disk, use +BACKUP_URL=nfs://nfs-server-name/share/path+

BACKUP_URL=*tape://*::
To backup to tape device, use +BACKUP_URL=tape:///dev/nst0+ or alternatively,
simply define +TAPE_DEVICE=/dev/nst0+

BACKUP_URL=*rsync://*::
When backup method +BACKUP=RSYNC+ is chosen then we need to define a corresponding +BACKUP_URL+ rule:
+
----
BACKUP_URL=rsync://[user@]host[:port]/path
BACKUP_URL=rsync://[user@]host[:port]::/path
----

BACKUP_URL=*cifs://*::
To backup to a Samba share (CIFS), use
+BACKUP_URL=cifs://cifs-server-name/share/path+. To provide credentials for
CIFS mounting use a _/etc/rear/cifs_ credentials file and define
+BACKUP_OPTIONS="cred=/etc/rear/cifs"+ and pass along:
+
----
username=_username_
password=_secret password_
domain=_domain_
----

BACKUP_URL=*usb://*::
To backup to USB storage device, use +BACKUP_URL=usb:///dev/disk/by-path/REAR-000+
or use a real device node or a specific filesystem label. Alternatively, you
can specify the device using +USB_DEVICE=/dev/disk/by-path/REAR-000+.
+
If you combine this with +OUTPUT=USB+ you will end up with a bootable USB
device.

BACKUP_URL=*sshfs://*::
To backup to a remote server via sshfs (SSH protocol), use
+BACKUP_URL=sshfs://user@remote-system.name.org/home/user/backup-dir/+
+
It is advisable to add *ServerAliveInterval 15* in the +/root/.ssh/config+
file for the remote system (remote-system.name.org).

BACKUP_URL=*iso://*::
To include the backup within the ISO image. It is important that the +BACKUP_URL+ and
+OUTPUT_URL+ variables are different. E.g.
+
----
BACKUP_URL=iso:///backup/
OUTPUT_URL=nfs://server/path/
----

When using +BACKUP=NETFS+ and BACKUP_PROG=tar there is an option to select
+BACKUP_TYPE=incremental+ or +BACKUP_TYPE=differential+ to let +rear+ make
incremental or differential backups until the next full backup day
e.g. via +FULLBACKUPDAY="Mon"+ is reached or when the last full backup
is too old after FULLBACKUP_OUTDATED_DAYS has passed.
Incremental or differential backup is currently only known to work
with +BACKUP_URL=nfs+. Other BACKUP_URL schemes may work but
at least +BACKUP_URL=usb+ requires USB_SUFFIX to be set
to work with incremental or differential backup.

== SUPPORT FOR SELF-ENCRYPTING DISKS

Relax-and-Recover supports self-encrypting disks (SEDs) compliant with the TCG
Opal 2 specification if the `sedutil-cli` executable is installed.

Self-encrypting disk support includes

* recovery (saving and restoring the system's SED configuration),
* setting up SEDs, including assigning a disk password,
* providing a pre-boot authentication (PBA) system to unlock SEDs at boot time.

To prepare booting from an SED, run +rear mkopalpba+, then create the rescue
system.

To set up an SED, boot the Relax-and-Recover rescue system and run`rear
opaladmin setupERASE DEVICE` (_DEVICE_ being the disk device path like
`/dev/sda`).

For complete information, consult the section "Support for TCG Opal 2-compliant
Self-Encrypting Disks" in the Relax-and-Recover user guide.

== CONFIGURATION
To configure Relax-and-Recover you have to edit the configuration files in
_/etc/rear/_.  All _*.conf_ files there 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 _/etc/rear/templates/_ there are also some template files which are used
by Relax-and-Recover to create configuration files (mostly for the boot
environment).  Modify the templates to adjust the information contained in
the emails produced by Relax-and-Recover. You can use these templates to
prepend your own configurations to the configuration files created by
Relax-and-Recover, for example you can edit _PXE_pxelinux.cfg_ to add some
general pxelinux configuration you use.

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.

See the default configuration file _/usr/share/rear/conf/default.conf_ for
an overview of the possible methods and their options.

An example to use TSM for backup and ISO for output would be to add
these lines to _/etc/rear/local.conf_ (no need to define a +BACKUP_URL+
when using an external backup solution):

    BACKUP=TSM
    OUTPUT=ISO

And if all your systems use NTP for time synchronisation, you can also
add these lines to _/etc/rear/site.conf_

    TIMESYNC=NTP

Do not forget to distribute the _site.conf_ to all your systems.

The resulting ISO image will be created in _/var/lib/rear/output/_.
You can now modify the behaviour by copying the appropriate
configuration variables from _default.conf_ to _local.conf_ and
changing them to suit your environment.


== EXIT STATUS
0::
    Successful program execution.
>0::
    Usage, syntax or execution errors. Check the log file in
    _/var/log/rear/_ for more information.


== EXAMPLES
To print out the current settings for +BACKUP+ and +OUTPUT+ methods and some
system information. This command can be used to see the supported features
for the given release and platform.

    # rear dump

To create a new rescue environment. Do not forget to copy the resulting
rescue system away so that you can use it in the case of a system failure.

    # rear -v mkrescue

To create a new rescue image together with a complete archive of your local
system run the command:

   # rear -v mkbackup


== FILES
/usr/sbin/rear::
The program itself.

/etc/rear/local.conf::
System specific configuration can be set here.

/etc/rear/site.conf::
Site specific configuration can be set here (not created by default).

/var/log/rear/::
Directory holding the log files.

/tmp/rear.##############::
Relax-and-Recover working directory. If Relax-and-Recover exits with an error,
you must remove this directory manually.

/usr/share/rear::
Relax-and-Recover script components.

/usr/share/rear/conf/default.conf::
Relax-and-Recover default values. Contains a complete set of parameters
and its explanation.  Please do not edit or modify. Copy values to
_local.conf_ or _site.conf_ instead.


== BUGS
Feedback is welcome, please report any issues or improvements to our
issue-tracker at: http://github.com/rear/issues/

Furthermore, we welcome pull requests via GitHub.

== SEE ALSO
Relax-and-Recover comes with extensive documentation located in
_/usr/share/doc_.


== AUTHORS
The ReaR project was initiated in 2006 by Schlomo Schapiro (https://github.com/schlomo) and Gratien D'haese (https://github.com/gdha) and has since then seen a lot of contributions by many authors. As ReaR deals with bare metal disaster recovery, there is a large amount of code that was contributed by owners and users of specialized hardware and software. Without their combined efforts and contributions ReaR would not be the universal Linux bare metal disaster recovery solution that it is today.

As time passed the project was lucky to get the support of additional developers to also help as maintainers: Dag Wieers (https://github.com/dagwieers), Jeroen Hoekx (https://github.com/jhoekx), Johannes Meixner (https://github.com/jsmeix), Vladimir Gozora (https://github.com/gozora) and Sébastien Chabrolles (https://github.com/schabrolles). We hope that ReaR continues to prove useful and to attract more developers who agree to be maintainers.  Please refer to the MAINTAINERS (https://github.com/rear/rear/blob/master/MAINTAINERS) file for the list of active and past maintainers.

To see the full list of authors and their contributions please look at the git history (https://github.com/rear/rear/graphs/contributors). We are very thankful to all authors and encourage anybody interested to take a look at our source code and to contribute what you find important.

Relax-and-Recover is a collaborative process using Github at http://github.com/rear/

The Relax-and-Recover website is located at: http://relax-and-recover.org/


== COPYRIGHT
(c) 2006-2018

The copyright is held by the original authors of the respective code pieces as can be seen in the git history at https://github.com/rear/rear/graphs/contributors

Relax-and-Recover comes with ABSOLUTELY NO WARRANTY; for details
see the GNU General Public License at http://www.gnu.org/licenses/gpl.html
