Debian Codegraph @

README.md

raw symbols SCIP
1 # Relax-and-Recover Linux Disaster Recovery & Bare Metal Restore
2
3 Relax-and-Recover (abbreviated ReaR) is the de facto standard disaster recovery framework on Linux.
4
5 It is in particular used on enterprise Linux distributions like Red Hat Enterprise Linux (RHEL)
6 and SUSE Linux Enterprise Server (SLES).
7
8 ReaR is a system administrator tool and framework to create a bootable disaster recovery system image
9 for bare metal disaster recovery with data backup restore on physical or virtual replacement hardware.
10
11 For bare metal disaster recovery the ReaR recovery system is booted on pristine replacement hardware.
12 On replacement hardware first the storage setup/layout is recreated (disk partitioning, filesystems, mount points),
13 then a backup restore program is called to restore the data (system files) into the recreated storage,
14 and finally a boot loader is installed.
15
16 System administrators use the ReaR framework to set up a disaster recovery procedure
17 as part of their disaster recovery policy (which complements their existing backup policy).
18
19 ReaR complements backup and restore of data with bare metal disaster recovery. ReaR can also act as local backup software,
20 but ReaR is not a a backup management software. In many enterprise environmentments, data backup and restore happens via dedicated backup software which is integrated by ReaR and used to restore the data onto a replacement system as part of the automated disaster recovery procedure implemented by ReaR.
21
22 ReaR has support for built-in backup methods using 'tar' and 'rsync' that are used for backup and restore.
23
24 ReaR integrates supports the following 3rd party, also commercial, tools for restoring a backup.
25
26 The complete list of backup methods (`BACKUP=...`) is:
27
28 * `AVA` Dell EMC Avamar / EMC Avamar
29 * `BACULA` Bacula
30 * `BAREOS` [Bareos](https://docs.bareos.org/Appendix/DisasterRecoveryUsingBareos.html#linux)
31 * `BLOCKCLONE` block device cloning via `dd`
32 * `BORG` Borg Backup
33 * `CDM` Rubrik Cloud Data Management
34 * `DP` OpenText Data Protector
35 * `DUPLICITY` Duplicity / Duply
36 * `EXTERNAL` External custom restore method
37 * `FDRUPSTREAM` FDR/Upstream
38 * `GALAXY11` Commvault Galaxy 11 / Commvault Simpana
39 * `NBKDC` NovaStor DataCenter
40 * `NBU` Veritas NetBackup / Symantec NetBackup
41 * `NETFS` ReaR built-in backup and restore via `rsync` or `tar` to a network file system or to a locally attached backup disk (USB, eSATA, ...)
42 * `NFS4SERVER` NFS4 server to push data *to* the rescue system
43 * `NSR` Dell EMC NetWorker / EMC NetWorker / Legato NetWorker
44 * `OBDR` One Button Disaster Recovery via tape
45 * `PPDM` [Dell PowerProtect Data Manager](https://infohub.delltechnologies.com/en-us/t/simplifying-linux-bmr-for-powerprotect-data-manager-using-rear-relax-and-recover-disaster-recovery-solution/)
46 * `RBME` [Rsync Backup Made Easy](https://github.com/schlomo/rbme)
47 * `REQUESTRESTORE` Request restore from a human operator
48 * `RSYNC` ReaR built-in backup using `rsync` via `rsync` or `ssh` protocol
49 * `SESAM` [SEP Sesam](https://wiki.sep.de/wiki/index.php/Bare_Metal_Recovery_Linux)
50 * `TSM` IBM Storage Protect / Tivoli Storage Manager / IBM Spectrum Protect
51 * `VEEAM` Veeam Backup
52
53 ReaR integrates well with Disaster Recovery Linux Manager (DRLM) [drlm.org](https://drlm.org), which can act as a central management tool for ReaR deployments.
54
55 [Professional services and support are available.](https://relax-and-recover.org/support/)
56
57 ## REQUIREMENTS
58
59 Relax-and-Recover is written entirely in Bash and does not require any
60 external programs. It utilizes the standard tools on your Linux system to
61 create the rescue system, and works out of the box on most systems.
62
63 ReaR supports many different use cases and includes support for many 3rd party backup tools. Therefore
64 our packages have only the dependencies for the ReaR core functionality, but not for all the tools
65 required for all the ReaR features. This is to keep your install size small when you don't need all the features. When using it, ReaR will let you know if your specific use case or workflow requires additional tools and ask you to install them.
66
67 ## QUICK START GUIDE
68
69 **Note**: Instead of cloning the sources from GitHub you can also download and install a snapshot build from our [GitHub Releases](https://github.com/rear/rear/releases) page and continue from `rear format`.
70
71 This quick start guide shows how to run Relax-and-Recover from the git checkout
72 and create a bootable USB backup and rescue medium.
73
74 Start by cloning the Relax-and-Recover sources from GitHub:
75
76 ```shell
77 git clone https://github.com/rear/rear.git
78 ````
79
80 Move into the 'rear/' directory (it gets created by `git clone`):
81
82 ```shell
83 cd rear/
84 ````
85
86 Prepare your USB medium.
87
88 Change `/dev/sdX` to the correct device in your environment.
89 Relax-and-Recover will 'own' the whole device.
90
91 **This will destroy all data on that device.**
92
93 ```shell
94 sudo usr/sbin/rear format /dev/sdX
95 ```
96
97 Relax-and-Recover asks you to confirm that you want to format your USB device:
98
99 ```shell
100 Yes
101 ````
102
103 The device gets labeled `REAR-000` by the `rear format` workflow.
104
105 Now edit the `etc/rear/local.conf` configuration file:
106
107 ```shell
108 ### write the rescue initramfs to USB and update the USB bootloader
109 OUTPUT=USB
110
111 ### create a backup using the internal NETFS method, using 'tar'
112 BACKUP=NETFS
113
114 ### write both rescue image and backup to the device labeled REAR-000
115 BACKUP_URL=usb:///dev/disk/by-label/REAR-000
116 ```
117
118 Ensure you have at least defined the *OUTPUT*, *BACKUP* and *BACKUP_URL* variables.
119
120 Now you are ready to create a ReaR rescue image on your USB device.
121 We want verbose output (-v option):
122
123 ```shell
124 sudo usr/sbin/rear -v mkrescue
125 ````
126
127 The output you get will look like this:
128 ```
129 Relax-and-Recover <version>
130 Using log file: /var/log/rear/rear-<hostname>.log
131 Creating disk layout
132 Creating root filesystem layout
133 Copying files and directories
134 Copying binaries and libraries
135 Copying kernel modules
136 Creating initramfs
137 Writing MBR to /dev/sdX
138 Copying resulting files to usb location
139 ```
140
141 You may check the log file for possible errors or see more details what Relax-and-Recover is doing.
142
143 Now reboot your system and verify that you can boot the ReaR rescue environment from your USB device as a test.
144 In the ReaR rescue environment log in as `root` (no password) and directly shut it down (it was only a test).
145
146 Again boot your normal system.
147
148 In your normal system (with your `REAR-000` labeled USB rescue device connected)
149 create a backup of your system (provided your USB device has enough space) by using:
150
151 ```shell
152 sudo usr/sbin/rear -v mkbackup
153 ```
154
155 The output you get will look like the above but now with a backup done at the end.
156
157 When all went well (also check the log file),
158 you have a bootable USB rescue medium with a backup of your system.
159
160 You are now better prepared for disaster recovery.
161
162 If your system got destroyed you can boot from your USB backup and rescue medium,
163 log in as `root` into the ReaR rescue environment and call `rear -v recover`.
164 This will completely re-create your system from scratch and restore your backup
165 which will destroy and overwrite all previously existing data on your system disk.
166 So to test if `rear recover` works, you need fully compatible replacement hardware
167 where you can verify that `rear recover` works (at least on your replacement hardware).
168
169 ## INSTALLATION
170
171 We recommend installing a suitable `rear` package that we provide, see the [Relax-and-Recover Download page](https://relax-and-recover.org/download/). On RHEL, SUSE, Ubuntu, Debian, Arch Linux, and other distributions, you can install the package with the package manager of your distribution.
172
173 Alternatively as a software developer you may manually build it from the source tree with:
174
175 ```shell
176 make package
177 ```
178
179 This will create a package for your distribution in `dist`.
180
181 Alternatively as a software developer you may install manually via:
182
183 ```shell
184 make install
185 ```
186
187 Do not mix different installation methods.
188
189 You should remove a package before doing a manual installation.
190
191 ## CONFIGURATION
192
193 **Note:** This is just a quick overview, please take a look at our full [Relax-and-Recover documentation](https://relax-and-recover.org/documentation/) for more details.
194
195 To configure Relax-and-Recover you have to edit the configuration files in
196
197 `/etc/rear/`. All `*.conf` files there are part of the configuration, but
198 only `site.conf` and `local.conf` are intended for the user configuration.
199 All other configuration files hold defaults for various distributions and
200 should not be changed.
201
202 In `/etc/rear/templates/` there are also some template files which are use by
203 Relax-and-Recover to create configuration files (mostly for the boot
204 environment). You can use these templates to prepend your own configurations
205 to the configuration files created by Relax-and-Recover, for example you can
206 edit `PXE_pxelinux.cfg` to add some general pxelinux configuration you use
207 (I put there stuff to install Linux over the network).
208
209 In almost all circumstances you have to configure two main settings and their
210 parameters: The *BACKUP* method and the *OUTPUT* method.
211
212 The backup method defines how your data is to be saved and whether Relax-and-Recover
213 should backup your data as part of the mkrescue process or whether you use an
214 external application, e.g. backup software to archive your data.
215
216 The output method defines how the rescue system is written to disk and how you
217 plan to boot the failed computer from the rescue system.
218
219 See `/usr/share/rear/conf/default.conf` for an overview of the possible methods
220 and their options. An example to use TSM for backup and PXE for output and
221 would be to add these lines to `/etc/rear/local.conf`:
222
223 ```shell
224 BACKUP=TSM
225 OUTPUT=PXE
226 ```
227
228 And since all your computers use NTP for time synchronisation, you should also add these lines to `/etc/rear/local.conf`:
229
230 ```shell
231 TIMESYNC=NTP
232 ```
233
234 Don’t forget to distribute the `local.conf` to all your systems.
235
236 The resulting PXE files (kernel, initrd and pxelinux configuration) will be
237 written to files in `/var/lib/rear/output/`. You can now modify the behaviour
238 by copying the appropriate configuration variables from `default.conf` to
239 `local.conf` and changing them to suit your environment.
240
241 In this example we used the `local.conf` file which is intended for local and *manual* configuration. To distribute the configuration to all your systems you should use the `site.conf` file which is intended for *automated* configuration. This file will never be part of the `rear` package to avoid conflicts between our packages and your configuration management. To this end our `local.conf` doesn't actually contain any settings by default.
242
243 ## USAGE
244
245 To use Relax-and-Recover you always call the main script `/usr/sbin/rear`:
246
247 ```shell
248 # rear help
249
250 Usage: rear [-h|--help] [-V|--version] [-dsSv] [-D|--debugscripts SET] [-c DIR] [-C CONFIG] [-r KERNEL] [-n|--non-interactive] [-e|--expose-secrets] [-p|--portable] [--] COMMAND [ARGS...]
251
252 Relax-and-Recover comes with ABSOLUTELY NO WARRANTY; for details see
253 the GNU General Public License at: http://www.gnu.org/licenses/gpl.html
254
255 Available options:
256 -h --help usage information (this text)
257 -c DIR alternative config directory; instead of /src/rear/etc/rear
258 -C CONFIG additional config files; absolute path or relative to config directory
259 -d debug mode; run many commands verbosely with debug messages in log file (also sets -v)
260 -D debugscript mode; log executed commands via 'set -x' (also sets -v and -d)
261 --debugscripts SET same as -d -v -D but debugscript mode with 'set -SET'
262 -r KERNEL kernel version to use; currently '5.15.0-204.147.6.3.el9uek.x86_64'
263 -s simulation mode; show what scripts are run (without executing them)
264 -S step-by-step mode; acknowledge each script individually
265 -v verbose mode; show messages what Relax-and-Recover is doing on the terminal or show verbose help
266 -n --non-interactive non-interactive mode; aborts when any user input is required (experimental)
267 -e --expose-secrets do not suppress output of confidential values (passwords, encryption keys) in particular in the log file
268 -p --portable allow running any ReaR workflow, especially recover, from a git checkout or rear source archive
269 -V --version version information
270
271
272 List of commands:
273 checklayout check if the disk layout has changed
274 dump dump configuration and system information
275 format Format and label medium for use with ReaR
276 mkbackup create rescue media and backup system
277 mkbackuponly backup system without creating rescue media
278 mkopalpba create a pre-boot authentication (PBA) image to boot from TCG Opal 2-compliant self-encrypting disks
279 mkrescue create rescue media only
280 mountonly use ReaR as live media to mount and repair the system
281 opaladmin administrate TCG Opal 2-compliant self-encrypting disks
282 recover recover the system
283 restoreonly only restore the backup
284 validate submit validation information
285 Use 'rear -v help' for more advanced commands.
286 ```
287
288 To view/verify your configuration, run `rear dump`. It will print out the
289 current settings for *BACKUP* and *OUTPUT* methods and some system information.
290
291 To create a new rescue environment, simply call `rear mkrescue`. Do not forget
292 to copy the resulting rescue system away so that you can use it in the case of
293 a system failure. Use `rear mkbackup` instead if you are using the builtin
294 backup functions (like `BACKUP=NETFS`)
295
296 To recover your system, start the replacement computer from the rescue system and run
297 `rear recover`. Your system will be recovered and you can restart it and
298 continue to use it normally.
299
300 ## AUTHORS AND MAINTAINERS
301
302 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.
303
304 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), [Sébastien Chabrolles](https://github.com/schabrolles), [Renaud Métrich](https://github.com/rmetrich) and [Pavel Cahyna](https://github.com/pcahyna). We hope that ReaR continues to prove useful and to attract more developers who agree to be maintainers. Please refer to the [MAINTAINERS](MAINTAINERS) file for the list of active and past maintainers.
305
306 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.