Debian Codegraph @

doc/user-guide/04-scenarios.adoc

raw
1 // FIXME: Add the various scenarios, merge with configuration-examples.txt +
2 // and the below content +
3 // e.g. using different backup methods, +
4 // using different output methods
5
6 = Scenarios
7
8 == Bootable ISO
9 If you simply want a bootable ISO on a central server, you would do:
10
11 [source,bash]
12 ----
13 OUTPUT=ISO
14 OUTPUT_URL=http://server/path-to-push/
15 ----
16
17 == Bootable ISO with an external (commercial) backup software
18 If you rely on your backup software to do the full restore of a system then you could define:
19
20 [source,bash]
21 ----
22 OUTPUT=ISO
23 BACKUP=[TSM|NSR|DP|NBU|GALAXY10|SEP|DUPLICITY|BACULA|BAREOS|RBME|FDRUPSTREAM]
24 ----
25
26 When using one of the above backup solution (commercial or open source) then there is no need to use +rear mkbackup+ as the backup workflow would be empty. Just use +rear mkrescue+
27
28 ReaR will incorporate the needed executables and libraries of your chosen backup solution into the rescue image of ReaR.
29
30 == Bootable ISO together with backup archive stored on NFS/NAS
31 To create an ISO rescue image and using a central NFS/NAS server to store it together with the backup archive, you could define:
32
33 [source,bash]
34 ----
35 OUTPUT=ISO
36 BACKUP=NETFS
37 # BACKUP_OPTIONS="nfsvers=3,nolock"
38 BACKUP_URL=nfs://your.NFS.server.IP/path/to/your/rear/backup
39 # BACKUP_PROG_CRYPT_ENABLED="yes"
40 # { BACKUP_PROG_CRYPT_KEY='my_secret_passphrase' ; } 2>/dev/null
41 ----
42
43 The above example shows that it is also possible to encrypt the backup archive.
44 Currently only 'tar' is supported for backup archive encryption and decryption.
45 When BACKUP_PROG_CRYPT_ENABLED is set to a true value, BACKUP_PROG_CRYPT_KEY must be also set.
46 There is no BACKUP_PROG_CRYPT_KEY value in the /etc/rear/local.conf file in the rescue image.
47 It gets removed because the ReaR rescue/recovery system must be free of secrets.
48 Otherwise the rescue system ISO image and any recovery medium that is made from it
49 would have to be carefully protected against any unwanted access.
50 Therefore BACKUP_PROG_CRYPT_KEY must be manually set before running "rear recover".
51 For example in the running ReaR rescue system via
52 `export BACKUP_PROG_CRYPT_KEY='my_secret_passphrase'`
53 before calling "rear recover".
54 You may also do this on the original system before calling "rear mkbackup"
55 so that there is no need to store it ever in a ReaR config file
56 but then ensure to run commands that contain 'my_secret_passphrase'
57 without keeping the command in a history file (e.g. ~/.bash_history).
58 On the other hand it is crucial to remember the BACKUP_PROG_CRYPT_KEY value
59 that was used during "rear mkbackup" so that possibly a long time later that
60 rescue image can be used (possibly by someone else) to recover from a disaster.
61 If the BACKUP_PROG_CRYPT_KEY value should be set in a ReaR config file
62 you should avoid that the BACKUP_PROG_CRYPT_KEY value is shown in a log file
63 when 'rear' is run in debugscript mode (where 'set -x' is set) by redirecting
64 STDERR to /dev/null via `{ command confidential_argument ; } 2>/dev/null`
65 where the redirection must be done via a compound group command even for
66 a single confidential command to let the redirection also apply for 'set -x'.
67 See the description in /usr/share/rear/conf/default.conf
68 how to set variables for secret values in a confidential way.
69
70 == Bootable ReaR rescue initramfs on IBM Z (s390x) under z/VM
71
72 If you want to create the rescue initramfs with a (tar) backup stored on NFS
73 server, add the following settings to `/etc/rear/local.conf`:
74
75 [source,bash]
76 ----
77 OUTPUT=RAMDISK
78 OUTPUT_URL=file:///path/to/initramfs
79 BACKUP=NETFS
80 BACKUP_URL=nfs://NFS.server.IP/path/to/backup
81 ----
82
83 Make sure that the path in `OUTPUT_URL` exists and create the rescue initramfs
84 and backup using `rear mkbackup`.
85
86 There are two options how to boot the rescue environment on IBM Z (s390x) under
87 z/VM created using the `OUTPUT=RAMDISK` setting.
88
89 1. Using the `kexec` tool as described in link:../../usr/share/rear/conf/templates/RESULT_usage_RAMDISK.txt[RESULT_usage_RAMDISK.txt],
90 if you have access to a running Linux instance.
91
92 2. Using the `zipl` tool for management of boot devices on s390/s390x.
93
94 === Booting ReaR rescue initramfs on IBM Z (s390x) under z/VM with `zipl`
95
96 First, we have to select a partition on the disk that we want to make bootable.
97 Assume that the disk is called `/dev/dasda` and the partition with the filesystem
98 that will contain the kernel and initramfs is `/dev/dasda1`.
99
100 We mount this partition to `/mnt/bootdisk` and copy there the kernel and initramfs
101 created in the previous section:
102 ```
103 # mount /dev/dasda1 /mnt/bootdisk
104 # cp /path/to/initramfs/HOSTNAME/* /mnt/bootdisk/
105 ```
106
107 NOTE: See `zipl(8)` for all device types supported by the `--target` option
108 (e.g. DASD, SCSI, ...). If you want to use a tape device, see `zipl(8)`
109 to use the `--tape` option instead. Note that the `--tape` option with
110 ReaR is untested so contributions to this guide are welcome! Also, it is
111 not possible to use `zipl` with the z/VM reader device.
112
113 IMPORTANT: The following method will overwrite the boot configuration on a device
114 which contains the given `--target` directory, in our case
115 `/dev/dasda`!
116
117 Use the following command to make the device mounted at `/mnt/bootdisk` bootable
118 with `zipl`:
119 ```
120 # zipl --target=/mnt/bootdisk \
121 --parameters='root=/dev/ram0 ro' \
122 --image=/mnt/bootdisk/kernel-HOSTNAME \
123 --ramdisk=/mnt/bootdisk/initramfs-HOSTNAME.img
124
125 Run /lib/s390-tools//zipl_helper.device-mapper /mnt/bootdisk/
126 Building bootmap in '/mnt/bootdisk/'
127 Adding IPL section
128 initial ramdisk...: /mnt/bootdisk/initramfs-HOSTNAME.img
129 kernel image......: /mnt/bootdisk/kernel-HOSTNAME
130 kernel parmline...: 'root=/dev/ram0 ro'
131 component address:
132 internal loader.: 0x0000a000-0x0000dfff
133 parameters......: 0x00009000-0x00009fff
134 kernel image....: 0x00010000-0x0076afff
135 parmline........: 0x0076c000-0x0076cfff
136 initial ramdisk.: 0x00780000-0x28708fff
137 environment blk.: 0x0077c000-0x0077cfff
138 Preparing boot device for CCW- and LD-IPL: dasda.
139 Done.
140 ```
141
142 If you want to boot the device with ReaR recovery from a running Linux
143 instance, you can use the `chreipl` tool to select a new default boot device
144 and reboot:
145 ```
146 # chreipl /mnt/bootdisk
147 Re-IPL type: ccw
148 Device: 0.0.0120
149 Loadparm: ""
150 Bootparms: ""
151 clear: 0
152 # reboot
153 ...
154 ```
155
156 If you do not have a running Linux instance at hand, you can force the boot
157 from the given device using the z/VM Control Program (CP) directly, e.g. through
158 a terminal connection.
159
160 The following example only considers DASD disk devices. Consult the official
161 z/VM CP Manual for booting from other devices (e.g. FCP attached SCSI) or for
162 additional details in general.
163
164 Use the following command to boot from a DASD boot device through z/VM CP,
165 where the last argument corresponds to the virtual device number (`vdev`).
166 ```
167 CP IPL 0120
168 ```
169
170 The virtual device number can be either obtained from the `Bus-ID` column using
171 the `lsdasd -s` command from a running Linux instance:
172 ```
173 # lsdasd -s
174 Bus-ID Status Name Device Type BlkSz Size Blocks
175 ================================================================================
176 0120 active dasda 94:0 ECKD 4096 39128MB 10017000
177 ```
178 or directly from z/VM CP with the following query:
179 ```
180 CP QUERY VIRTUAL DASD
181 00:
182 00: CP QUERY VIRTUAL DASD
183 00: DASD 0120 ON DASD 2213 R/W 0X0120 SUBCHANNEL = 0004
184 00: DASD 0121 ON DASD 201A R/W 0X0121 SUBCHANNEL = 0005
185 ...
186 ```
187
188 == Bootable USB device with backup to USB
189 If you want a bootable USB device with a (tar) backup to USB as well, you
190 would use:
191
192 [source,bash]
193 ----
194 BACKUP=NETFS
195 OUTPUT=USB
196 USB_DEVICE=/dev/disk/by-label/REAR-000
197 ----
198
199
200 == Bootable tape drive (OBDR) with backup to tape
201 If you want an OBDR image and backup on tape, and use GNU tar for
202 backup/restore, you would use:
203
204 [source,bash]
205 ----
206 BACKUP=NETFS
207 OUTPUT=OBDR
208 TAPE_DEVICE=/dev/nst0
209 ----
210
211
212 == Bootable tape drive (OBDR) and Bacula restore
213 If you want an OBDR image on tape, and the Bacula tools to recover your
214 backup, use:
215
216 [source,bash]
217 ----
218 BACKUP=BACULA
219 OUTPUT=OBDR
220 TAPE_DEVICE=/dev/nst0
221 ----
222
223
224 == ReaR with Borg back end
225 - Install Borg backup (https://borgbackup.readthedocs.io/en/stable/installation.html).
226
227 IMPORTANT: We strongly recommend to use Borg standalone binary (https://github.com/borgbackup/borg/releases) as it includes all necessities for Borg operations.
228 If you decide to go for different type of Borg installation types, make sure you include all needed files for Borg runtime into ReaR rescue/recovery system.
229 E.g. by using `COPY_AS_IS_BORG=( '/usr/lib64/python3.4*' '/usr/bin/python3*' '/usr/bin/pyvenv*' '/usr/lib/python3.4*' '/usr/lib64/libpython3*' )`
230
231 === Borg -> SSH
232 - Setup ssh key infrastructure for user that will be running backup.
233 Issuing following command must work without any password prompts or remote host identity confirmation:
234
235 `ssh <BORGBACKUP_USERNAME>@<BORGBACKUP_HOST>`
236
237 - Example _local.conf_:
238 [source,bash]
239 ----
240 OUTPUT=ISO
241 OUTPUT_URL=nfs://foo.bar.xy/mnt/backup/iso
242
243 BACKUP=BORG
244 BORGBACKUP_HOST="foo.bar.xy"
245 BORGBACKUP_USERNAME="borg_user"
246 BORGBACKUP_REPO="/mnt/backup/client"
247 BORGBACKUP_REMOTE_PATH="/usr/local/bin/borg"
248
249 # Automatic archive pruning
250 # (https://borgbackup.readthedocs.io/en/stable/usage/prune.html)
251 BORGBACKUP_PRUNE_KEEP_WEEKLY=2
252
253 # Archive compression
254 # (https://borgbackup.readthedocs.io/en/stable/usage/create.html)
255 BORGBACKUP_COMPRESSION="lzma,6" # Slowest backup, best compression
256
257 # Repository encryption
258 # (https://borgbackup.readthedocs.io/en/stable/usage/init.html)
259 BORGBACKUP_ENC_TYPE="keyfile"
260 export BORG_PASSPHRASE='S3cr37_P455w0rD'
261 COPY_AS_IS_BORG=( "$ROOT_HOME_DIR/.config/borg/keys/" )
262
263 # Borg environment variables
264 # (https://borgbackup.readthedocs.io/en/stable/usage/general.html#environment-variables)
265 export BORG_RELOCATED_REPO_ACCESS_IS_OK="yes"
266 export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK="yes"
267
268 ----
269 === Borg -> USB
270
271 - Example _local.conf_:
272 [source,bash]
273 ----
274 OUTPUT=USB
275 BACKUP=BORG
276
277 USB_DEVICE=/dev/disk/by-label/REAR-000
278
279 BORGBACKUP_REPO="/my_borg_backup"
280 BORGBACKUP_UMASK="0002"
281
282 BORGBACKUP_PRUNE_KEEP_WEEKLY=2
283
284 BORGBACKUP_ENC_TYPE="keyfile"
285 export BORG_PASSPHRASE='S3cr37_P455w0rD'
286
287 export BORG_RELOCATED_REPO_ACCESS_IS_OK="yes"
288 export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK="yes"
289
290 COPY_AS_IS_EXCLUDE=( "${COPY_AS_IS_EXCLUDE[@]}" )
291 COPY_AS_IS_BORG=( "$ROOT_HOME_DIR/.config/borg/keys/" )
292
293 SSH_UNPROTECTED_PRIVATE_KEYS="yes"
294 SSH_FILES="yes"
295
296
297 ----
298
299 IMPORTANT: If using BORGBACKUP_ENC_TYPE="keyfile", don't forget to make your
300 encryption key available for case of restore!
301 (using `COPY_AS_IS_BORG=( "$ROOT_HOME_DIR/.config/borg/keys/" )` is a option to consider).
302 Be sure to read https://borgbackup.readthedocs.io/en/stable/usage/init.html,
303 and make your self familiar how encryption in Borg works.
304
305 - Executing `rear mkbackup` will create Relax-and-Recover rescue/recovery system and
306 start Borg backup process. Once backup finishes, it will also prune old archives from repository,
307 if at least one of `BORGBACKUP_PRUNE_KEEP_*` variables is set.
308 - To recover your system, boot Relax-and-Recover rescue/recovery system and trigger `rear recover`.
309 You will be prompted which archive to recover from Borg repository, once ReaR finished with layout configuration.
310
311 ```
312 ...
313 Disk layout created.
314 Starting Borg restore
315
316 === Borg archives list ===
317 Host: foo.bar.xy
318 Repository: /mnt/backup/client
319
320 [1] rear_1 Sun, 2016-10-16 14:08:16
321 [2] rear_2 Sun, 2016-10-16 14:32:11
322
323 [3] Exit
324
325 Choose archive to recover from:
326
327
328 ```
329
330
331 == Backup/restore alien file system using BLOCKCLONE and dd
332 === Configuration
333
334 - First we need to set some global options to _local.conf_
335
336 ```
337 # cat local.conf
338 OUTPUT=ISO
339 BACKUP=NETFS
340 BACKUP_OPTIONS="nfsvers=3,nolock"
341 BACKUP_URL=nfs://beta.virtual.sk/mnt/rear
342 ```
343
344 - Now we can define variables that will apply only for targeted block device
345
346 ```
347 # cat alien.conf
348 BACKUP=BLOCKCLONE # Define BLOCKCLONE as backup method
349 BACKUP_PROG_ARCHIVE="alien" # Name of image file
350 BACKUP_PROG_SUFFIX=".dd.img" # Suffix of image file
351 BACKUP_PROG_COMPRESS_SUFFIX="" # Clear additional suffixes
352
353 BLOCKCLONE_PROG=dd # Use dd for image creation
354 BLOCKCLONE_PROG_OPTS="bs=4k" # Additional options that will be passed to dd
355 BLOCKCLONE_SOURCE_DEV="/dev/sdc1" # Device that should be backed up
356
357 BLOCKCLONE_SAVE_MBR_DEV="/dev/sdc" # Device where partitioning information is stored (optional)
358 BLOCKCLONE_MBR_FILE="alien_boot_strap.img" # Output filename for boot strap code
359 BLOCKCLONE_PARTITIONS_CONF_FILE="alien_partitions.conf" # Output filename for partition configuration
360 BLOCKCLONE_ALLOW_MOUNTED="yes" # Device can be mounted during backup (default NO)
361 ```
362
363 === Running backup
364
365 - Save partitions configuration, bootstrap code and create actual backup of /dev/sdc1
366
367 ```
368 # rear -C alien mkbackuponly
369 ```
370
371 - Running restore from ReaR restore/recovery system
372
373 ```
374 # rear -C alien restoreonly
375
376 Restore alien.dd.img to device: [/dev/sdc1] # User is always prompted for restore destination
377 Device /dev/sdc1 was not found. # If destination does not exist ReaR will try to create it (or fail if BLOCKCLONE_SAVE_MBR_DEV was not set during backup)
378 Restore partition layout to (^c to abort): [/dev/sdc] # Prompt user for device where partition configuration should be restored
379 Checking that no-one is using this disk right now ... OK
380
381 Disk /dev/sdc: 5 GiB, 5368709120 bytes, 10485760 sectors
382 Units: sectors of 1 * 512 = 512 bytes
383 Sector size (logical/physical): 512 bytes / 512 bytes
384 I/O size (minimum/optimal): 512 bytes / 512 bytes
385
386 >>> Script header accepted.
387 >>> Script header accepted.
388 >>> Script header accepted.
389 >>> Script header accepted.
390 >>> Created a new DOS disklabel with disk identifier 0x10efb7a9.
391 Created a new partition 1 of type 'HPFS/NTFS/exFAT' and of size 120 MiB.
392
393 /dev/sdc2:
394 New situation:
395
396 Device Boot Start End Sectors Size Id Type
397 /dev/sdc1 4096 249855 245760 120M 7 HPFS/NTFS/exFAT
398
399 The partition table has been altered.
400 Calling ioctl() to re-read partition table.
401 Syncing disks.
402 ```
403
404
405 == Using Relax-and-Recover with USB storage devices
406 Using USB devices with Relax-and-Recover can be appealing for several reasons:
407
408 - If you only need to have a bootable rescue environment,
409 a USB device is a cheap device to store it (needs up to about 1 GB)
410
411 - When you have plenty of space, it could be a simple solution
412 to store complete disaster recovery images (rescue environment + backup)
413
414 However USB devices may be slow for backup purposes,
415 especially on older systems and/or with cheap devices.
416
417 === Configuring Relax-and-Recover for USB storage devices
418 The below configuration (_/etc/rear/local.conf_) gives a list of possible
419 options when you want to run Relax-and-Recover with USB storage.
420
421 [source,bash]
422 ----
423 BACKUP=BACULA
424 OUTPUT=USB
425 USB_DEVICE=/dev/disk/by-label/REAR-000
426 ----
427
428
429 === Preparing your USB storage device
430 To prepare your USB device for use with Relax-and-Recover, do: +rear format /dev/sdX+
431
432 This will will destroy all existing data on that device,
433 create new partitions and filesystems,
434 make it bootable,
435 and label it +REAR-000+
436
437
438 === USB storage as rescue media
439
440 ==== Configuring Relax-and-Recover to have Bacula tools
441 If the rescue environment needs additional tools and workflow, this can be
442 specified by using +BACKUP=BACULA+ in the configuration file
443 _/etc/rear/local.conf_:
444
445 [source,bash]
446 ----
447 BACKUP=BACULA
448 OUTPUT=USB
449 USB_DEVICE=/dev/disk/by-label/REAR-000
450 ----
451
452 ==== Making the rescue USB storage device
453 To create a rescue USB device, run +rear -v mkrescue+ as shown below after
454 you have inserted a *REAR-000* labeled USB device.
455
456 ----
457 [root@system ~]# rear -v mkrescue
458 Relax-and-Recover 1.12.0svn497 / 2011-07-11
459 Creating disk layout.
460 Creating root filesystem layout
461 Copying files and directories
462 Copying program files and libraries
463 Copying kernel modules
464 Creating initramfs
465 Finished in 72 seconds.
466 ----
467
468
469 [[booting-from-usb]]
470 ==== Booting from USB storage device
471 Before you can recover our DR backup, it is important to configure the BIOS to
472 boot from the USB device. In some cases it is required to go into the BIOS setup
473 (+F9+ during boot) to change the boot-order of devices. (In BIOS setup select
474 +Standard Boot Order (IPL)+)
475
476 Once booted from the USB device, select the system you like to recover from
477 the list. If you don't press a key within 30 seconds, the system will try to
478 boot from the local disk.
479
480 ["aafigure",width="12cm",height="6cm",align="center",format="svg",options="textual",aspect="0.7",linewidth="1"]
481 ----
482 +---------------------------------------------+
483 | "Relax-and-Recover v1.12.0svn497" |
484 +---------------------------------------------+
485 | "Recovery images" |
486 | "system.localdomain" > |
487 | "other.localdomain" > |
488 |---------------------------------------------|
489 | "Other actions" |
490 | "Help for Relax-and-Recover" |
491 | "Boot Local disk (hd1)" |
492 | "Boot BIOS disk (0x81)" |
493 | "Boot Next BIOS device" |
494 | "Hardware Detection tool" |
495 | "Memory test" |
496 | "Reboot system" |
497 | "Power off system" |
498 +---------------------------------------------+
499
500 "Press [Tab] to edit options or [F1] for help"
501
502 "Automatic boot in 30 seconds..."
503 ----
504
505 ////
506 .-------------------------------------------------------------.
507 | Relax-and-Recover v1.12.0svn497 |
508 |-------------------------------------------------------------|
509 | Recovery images |
510 | system.localdomain > |
511 | other.localdomain > |
512 |-------------------------------------------------------------|
513 | Other actions |
514 | Help for Relax-and-Recover |
515 (> Boot Local disk (hd1) <)
516 | Boot BIOS disk (0x81) |
517 | Boot Next BIOS device |
518 | Hardware Detection tool |
519 | Memory test |
520 | Reboot system |
521 | Power off system |
522 `-------------------------------------------------------------'
523
524 Press [Tab] to edit options or [F1] for help
525
526 Automatic boot in 30 seconds...
527 ////
528
529 WARNING: Booting from a local disk may fail when booting from a USB device.
530 This is caused by the fact that the GRUB bootloader on the local
531 disk is configured as if it is being the first drive +(hd0)+ but
532 it is in fact the second disk +(hd1)+.
533
534 Then select the image you would like to recover.
535
536 ["aafigure",width="14cm",height="7cm",align="center",format="svg",options="textual",aspect="0.7",linewidth="1"]
537 ----
538 +---------------------------------------------+
539 | "system.localdomain" |
540 +---------------------------------------------+
541 | "2011-03-26 02:16 backup" |
542 | "2011-03-25 18:39 backup" |
543 | "2011-03-05 16:12 rescue image" |
544 |---------------------------------------------|
545 | "Back" |
546 | |
547 | |
548 | |
549 | |
550 | |
551 | |
552 | |
553 | |
554 +---------------------------------------------+
555
556 "Press [Tab] to edit options or [F1] for help"
557
558
559 "Backup using kernel 2.6.32-122.el6.x86_64"
560 "BACKUP=NETFS OUTPUT=USB OUTPUT_URL=usb:///dev/disk/by-label/REAR-000"
561 ----
562
563 ////
564 .-------------------------------------------------------------.
565 | system.localdomain |
566 |-------------------------------------------------------------|
567 | 2011-03-26 02:16 backup |
568 (> 2011-03-25 18:39 backup <)
569 | 2011-03-05 16:12 rescue image |
570 |-------------------------------------------------------------|
571 | Back < |
572 | |
573 | |
574 | |
575 | |
576 | |
577 | |
578 | |
579 | |
580 | |
581 `-------------------------------------------------------------'
582
583 Press [Tab] to edit options or [F1] for help
584
585
586
587 Backup using kernel 2.6.32-122.el6.x86_64
588 BACKUP=NETFS OUTPUT=USB OUTPUT_URL=usb:///dev/disk/by-label/REAR-000
589 ////
590
591 TIP: When browsing through the images you get more information about the
592 image at the bottom of the screen.
593
594 ==== Restoring from USB rescue media
595 Then wait for the system to boot until you get the prompt.
596
597 On the shell prompt, type +rear recover+.
598
599 You may need to answer a few questions depending on your hardware
600 configuration and whether you are restoring to a (slightly)
601 different system.
602
603 ----
604 RESCUE SYSTEM:/ # rear recover
605 Relax-and-Recover 1.12.0svn497 / 2011-07-11
606 NOTICE: Will do driver migration
607 To recreate HP SmartArray controller 3, type exactly YES: YES
608 To recreate HP SmartArray controller 0, type exactly YES: YES
609 Clearing HP SmartArray controller 3
610 Clearing HP SmartArray controller 0
611 Recreating HP SmartArray controller 3|A
612 Configuration restored successfully, reloading CCISS driver... OK
613 Recreating HP SmartArray controller 0|A
614 Configuration restored successfully, reloading CCISS driver... OK
615 Comparing disks.
616 Disk configuration is identical, proceeding with restore.
617 Type "Yes" if you want DRBD resource rBCK to become primary: Yes
618 Type "Yes" if you want DRBD resource rOPS to become primary: Yes
619 Start system layout restoration.
620 Creating partitions for disk /dev/cciss/c0d0 (msdos)
621 Creating partitions for disk /dev/cciss/c2d0 (msdos)
622 Creating software RAID /dev/md2
623 Creating software RAID /dev/md6
624 Creating software RAID /dev/md3
625 Creating software RAID /dev/md4
626 Creating software RAID /dev/md5
627 Creating software RAID /dev/md1
628 Creating software RAID /dev/md0
629 Creating LVM PV /dev/md6
630 Creating LVM PV /dev/md5
631 Creating LVM PV /dev/md2
632 Creating LVM VG vgrem
633 Creating LVM VG vgqry
634 Creating LVM VG vg00
635 Creating LVM volume vg00/lv00
636 Creating LVM volume vg00/lvdstpol
637 Creating LVM volume vg00/lvsys
638 Creating LVM volume vg00/lvusr
639 Creating LVM volume vg00/lvtmp
640 Creating LVM volume vg00/lvvar
641 Creating LVM volume vg00/lvopt
642 Creating ext3-filesystem / on /dev/mapper/vg00-lv00
643 Mounting filesystem /
644 Creating ext3-filesystem /dstpol on /dev/mapper/vg00-lvdstpol
645 Mounting filesystem /dstpol
646 Creating ext3-filesystem /dstpol/sys on /dev/mapper/vg00-lvsys
647 Mounting filesystem /dstpol/sys
648 Creating ext3-filesystem /usr on /dev/mapper/vg00-lvusr
649 Mounting filesystem /usr
650 Creating ext2-filesystem /tmp on /dev/mapper/vg00-lvtmp
651 Mounting filesystem /tmp
652 Creating ext3-filesystem /boot on /dev/md0
653 Mounting filesystem /boot
654 Creating ext3-filesystem /var on /dev/mapper/vg00-lvvar
655 Mounting filesystem /var
656 Creating ext3-filesystem /opt on /dev/mapper/vg00-lvopt
657 Mounting filesystem /opt
658 Creating swap on /dev/md1
659 Creating DRBD resource rBCK
660 Writing meta data...
661 initializing activity log
662 New drbd meta data block successfully created.
663 Creating LVM PV /dev/drbd2
664 Creating LVM VG vgbck
665 Creating LVM volume vgbck/lvetc
666 Creating LVM volume vgbck/lvvar
667 Creating LVM volume vgbck/lvmysql
668 Creating ext3-filesystem /etc/bacula/cluster on /dev/mapper/vgbck-lvetc
669 Mounting filesystem /etc/bacula/cluster
670 Creating ext3-filesystem /var/bacula on /dev/mapper/vgbck-lvvar
671 Mounting filesystem /var/bacula
672 Creating ext3-filesystem /var/lib/mysql/bacula on /dev/mapper/vgbck-lvmysql
673 Mounting filesystem /var/lib/mysql/bacula
674 Creating DRBD resource rOPS
675 Writing meta data...
676 initializing activity log
677 New drbd meta data block successfully created.
678 Creating LVM PV /dev/drbd1
679 Creating LVM VG vgops
680 Creating LVM volume vgops/lvcachemgr
681 Creating LVM volume vgops/lvbackup
682 Creating LVM volume vgops/lvdata
683 Creating LVM volume vgops/lvdb
684 Creating LVM volume vgops/lvswl
685 Creating LVM volume vgops/lvcluster
686 Creating ext3-filesystem /opt/cache on /dev/mapper/vgops-lvcachemgr
687 Mounting filesystem /opt/cache
688 Creating ext3-filesystem /dstpol/backup on /dev/mapper/vgops-lvbackup
689 Mounting filesystem /dstpol/backup
690 Creating ext3-filesystem /dstpol/data on /dev/mapper/vgops-lvdata
691 Mounting filesystem /dstpol/data
692 Creating ext3-filesystem /dstpol/databases on /dev/mapper/vgops-lvdb
693 Mounting filesystem /dstpol/databases
694 Creating ext3-filesystem /dstpol/swl on /dev/mapper/vgops-lvswl
695 Mounting filesystem /dstpol/swl
696 Creating ext3-filesystem /dstpol/sys/cluster on /dev/mapper/vgops-lvcluster
697 Mounting filesystem /dstpol/sys/cluster
698 Disk layout created.
699
700 The system is now ready to restore from Bacula. You can use the 'bls' command
701 to get information from your Volume, and 'bextract' to restore jobs from your
702 Volume. It is assumed that you know what is necessary to restore - typically
703 it will be a full backup.
704
705 You can find useful Bacula commands in the shell history. When finished, type
706 'exit' in the shell to continue recovery.
707
708 WARNING: The new root is mounted under '/mnt/local'.
709
710 rear>
711 ----
712
713
714 [[restoring-from-bacula-tape]]
715 ==== Restoring from Bacula tape
716 Now you need to continue with restoring the actual Bacula backup, for this you
717 have multiple options of which +bextract+ is the most easy and
718 straightforward, but also the slowest and unsafest.
719
720
721 ===== Using a bootstrap file
722 If you know the JobId of the latest successful full backup, and differential
723 backups the most efficient way to restore is by creating a bootstrap file with
724 this information and using it to restore from tape.
725
726 A bootstrap file looks like this:
727
728 ----
729 Volume = VOL-1234
730 JobId = 914
731 Job = Bkp_Daily
732 ----
733
734 or
735
736 ----
737 Volume = VOL-1234
738 VolSessionId = 1
739 VolSessionTime = 108927638
740 ----
741
742 Using a bootstrap file with bextract is easy, simply do:
743 +bextract -b bootstrap.txt Ultrium-1 /mnt/local+
744
745 TIP: It helps to know exactly how many files you need to restore, and using
746 the +FileIndex+ and +Count+ keywords so +bextract+ does not require to
747 read the whole tape. Use the commands in your shell history to access
748 an example Bacula bootstrap file.
749
750
751 ===== Using bextract
752 To use +bextract+ to restore *everything* from a single tape, you can do:
753 +bextract -V VOLUME-NAME Ultrium-1 /mnt/local+
754
755 ----
756 rear> bextract -V VOL-1234 Ultrium-1 /mnt/local
757 bextract: match.c:249-0 add_fname_to_include prefix=0 gzip=0 fname=/
758 bextract: butil.c:282 Using device: "Ultrium-1" for reading.
759 30-Mar 16:00 bextract JobId 0: Ready to read from volume "VOL-1234" on device "Ultrium-1" (/dev/st0).
760 bextract JobId 0: -rw-r----- 1 252 bacula 3623795 2011-03-30 11:02:18 /mnt/local/var/lib/bacula/bacula.sql
761 bextract JobId 0: drwxr-xr-x 2 root root 4096 2011-02-02 11:48:28 *none*
762 bextract JobId 0: drwxr-xr-x 4 root root 1024 2011-02-23 13:09:53 *none*
763 bextract JobId 0: drwxr-xr-x 12 root root 4096 2011-02-02 11:50:00 *none*
764 bextract JobId 0: -rwx------ 1 root root 0 2011-02-02 11:48:24 /mnt/local/.hpshm_keyfile
765 bextract JobId 0: -rw-r--r-- 1 root root 0 2011-02-22 12:38:03 /mnt/local/.autofsck
766 ...
767 30-Mar 16:06 bextract JobId 0: End of Volume at file 7 on device "Ultrium-1" (/dev/st0), Volume "VOL-1234"
768 30-Mar 16:06 bextract JobId 0: End of all volumes.
769 30-Mar 16:07 bextract JobId 0: Alert: smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
770 30-Mar 16:07 bextract JobId 0: Alert: Home page is http://smartmontools.sourceforge.net/
771 30-Mar 16:07 bextract JobId 0: Alert:
772 30-Mar 16:07 bextract JobId 0: Alert: TapeAlert: OK
773 30-Mar 16:07 bextract JobId 0: Alert:
774 30-Mar 16:07 bextract JobId 0: Alert: Error counter log:
775 30-Mar 16:07 bextract JobId 0: Alert: Errors Corrected by Total Correction Gigabytes Total
776 30-Mar 16:07 bextract JobId 0: Alert: ECC rereads/ errors algorithm processed uncorrected
777 30-Mar 16:07 bextract JobId 0: Alert: fast | delayed rewrites corrected invocations [10^9 bytes] errors
778 30-Mar 16:07 bextract JobId 0: Alert: read: 1546 0 0 0 1546 0.000 0
779 30-Mar 16:07 bextract JobId 0: Alert: write: 0 0 0 0 0 0.000 0
780 165719 files restored.
781 ----
782
783 WARNING: In this case +bextract+ will restore all the Bacula jobs on the
784 provided tapes, start from the oldest, down to the latest. As a
785 consequence, deleted files may re-appear and the process may take
786 a very long time.
787
788
789 ==== Finish recovery process
790 Once finished, continue Relax-and-Recover by typing +exit+.
791
792 ----
793 rear> exit
794 Did you restore the backup to /mnt/local ? Ready to continue ? y
795 Installing GRUB boot loader
796
797 Finished recovering your system. You can explore it under '/mnt/local'.
798
799 Finished in 4424 seconds.
800 ----
801
802 IMPORTANT: If you neglect to perform this last crucial step, your new system
803 will not boot and you have to install a boot-loader yourself
804 manually, or re-execute this procedure.
805
806
807 === USB storage as backup media
808
809 ==== Configuring Relax-and-Recover for backup to USB storage device
810 The below configuration (_/etc/rear/local.conf_) gives a list of possible
811 options when you want to run Relax-and-Recover with USB storage.
812
813 [source,bash]
814 ----
815 BACKUP=NETFS
816 OUTPUT=USB
817 USB_DEVICE=/dev/disk/by-label/REAR-000
818
819 ### Exclude certain items
820 ONLY_INCLUDE_VG=( vg00 )
821 EXCLUDE_MOUNTPOINTS=( /data )
822 ----
823
824
825 ==== Making the DR backup to USB storage device
826 Creating a combined rescue device that integrates the backup on USB, it is
827 sufficient to run +rear -v mkbackup+ as shown below after you have inserted
828 the USB device. Make sure the device name for the USB device is what is
829 configured.
830
831 ----
832 [root@system ~]# rear -v mkbackup
833 Relax-and-Recover 1.12.0svn497 / 2011-07-11
834 Creating disk layout.
835 Creating root filesystem layout
836 Copying files and directories
837 Copying program files and libraries
838 Copying kernel modules
839 Creating initramfs
840 Creating archive 'usb:///dev/sda1/system.localdomain/20110326.0216/backup.tar.gz'
841 Total bytes written: 3644416000 (3.4GiB, 5.5MiB/s) in 637 seconds.
842 Writing MBR to /dev/sda
843 Modifying local GRUB configuration
844 Copying resulting files to usb location
845 Finished in 747 seconds.
846 ----
847
848 IMPORTANT: It is advised to go into single user mode (+init 1+) before creating
849 a backup to ensure all active data is consistent on disk (and no
850 important processes are active in memory)
851
852
853 ==== Booting from USB storage device
854 See the section <<booting-from-usb,Booting from USB storage device>> for more
855 information about how to enable your BIOS to boot from a USB storage device.
856
857
858 ==== Restoring a backup from USB storage device
859 Then wait for the system to boot until you get the prompt.
860
861 On the shell prompt, type +rear recover+.
862
863 You may need to answer a few questions depending on your hardware
864 configuration and whether you are restoring to a (slightly)
865 different system.
866
867 ----
868 RESCUE SYSTEM:/ # rear recover
869 Relax-and-Recover 1.12.0svn497 / 2011-07-11
870 Backup archive size is 1.2G (compressed)
871 To recreate HP SmartArray controller 1, type exactly YES: YES
872 To recreate HP SmartArray controller 7, type exactly YES: YES
873 Clearing HP SmartArray controller 1
874 Clearing HP SmartArray controller 7
875 Recreating HP SmartArray controller 1|A
876 Configuration restored successfully, reloading CCISS driver... OK
877 Recreating HP SmartArray controller 7|A
878 Configuration restored successfully, reloading CCISS driver... OK
879 Comparing disks.
880 Disk configuration is identical, proceeding with restore.
881 Start system layout restoration.
882 Creating partitions for disk /dev/cciss/c0d0 (msdos)
883 Creating partitions for disk /dev/cciss/c1d0 (msdos)
884 Creating software RAID /dev/md126
885 Creating software RAID /dev/md127
886 Creating LVM PV /dev/md127
887 Restoring LVM VG vg00
888 Creating ext3-filesystem / on /dev/mapper/vg00-lv00
889 Mounting filesystem /
890 Creating ext3-filesystem /boot on /dev/md126
891 Mounting filesystem /boot
892 Creating ext3-filesystem /data on /dev/mapper/vg00-lvdata
893 Mounting filesystem /data
894 Creating ext3-filesystem /opt on /dev/mapper/vg00-lvopt
895 Mounting filesystem /opt
896 Creating ext2-filesystem /tmp on /dev/mapper/vg00-lvtmp
897 Mounting filesystem /tmp
898 Creating ext3-filesystem /usr on /dev/mapper/vg00-lvusr
899 Mounting filesystem /usr
900 Creating ext3-filesystem /var on /dev/mapper/vg00-lvvar
901 Mounting filesystem /var
902 Creating swap on /dev/mapper/vg00-lvswap
903 Disk layout created.
904 Restoring from 'usb:///dev/sda1/system.localdomain/20110326.0216/backup.tar.gz'
905 Restored 3478 MiB in 134 seconds [avg 26584 KiB/sec]
906 Installing GRUB boot loader
907
908 Finished recovering your system. You can explore it under '/mnt/local'.
909
910 Finished in 278 seconds.
911 ----
912
913 If all is well, you can now remove the USB device, restore the BIOS boot order
914 and reboot the system into the recovered OS.
915
916
917 == Using Relax-and-Recover with OBDR tapes
918 Using One-Button-Disaster-Recovery (OBDR) tapes has a few benefits.
919
920 - Within large organisations tape media is already *part of a workflow*
921 for offsite storage and is a *known and trusted technology*
922
923 - Tapes can store large amounts of data reliably and restoring large
924 amounts of data is *predictable* in time and effort
925
926 - OBDR offers *booting from tapes*, which is very convenient
927
928 - A single tape can hold both the rescue image as well as a *complete
929 snapshot* of the system (up to 1.6TB with LTO4)
930
931 However, you need one tape per system as an OBDR tape can only store one
932 single rescue environment.
933
934
935 === Configuring Relax-and-Recover for OBDR rescue tapes
936 The below configuration (_/etc/rear/local.conf_) gives a list of possible
937 options when you want to run Relax-and-Recover with a tape drive. This
938 example shows how to use the tape *only* for storing the rescue image,
939 the backup is expected to be handled by Bacula and so the Bacula tools
940 are included in the rescue environment to enable a Bacula restore.
941
942 [source,bash]
943 ----
944 OUTPUT=OBDR
945 TAPE_DEVICE=/dev/nst0
946 ----
947
948
949 === Preparing your OBDR rescue tape
950 To protect normal backup tapes (in case tape drives are also used by another
951 backup solution) Relax-and-Recover expects that the tape to use is labeled
952 *REAR-000*. To achieve this is to insert a blank tape to use for
953 Relax-and-Recover and run the +rear format /dev/stX+ command.
954
955
956 === OBDR tapes as rescue media
957
958 ==== Configuring Relax-and-Recover to have Bacula tools
959 If the rescue environment needs additional tools and workflow, this can be
960 specified by using +BACKUP=BACULA+ in the configuration file
961 _/etc/rear/local.conf_:
962
963 [source,bash]
964 ----
965 BACKUP=BACULA
966 OUTPUT=OBDR
967 BEXTRACT_DEVICE=Ultrium-1
968 BEXTRACT_VOLUME=VOL-*
969 ----
970
971 Using the +BEXTRACT_DEVICE+ allows you to use the tape device that is
972 referenced from the Bacula configuration. This helps in those cases where the
973 discovery of the various tape drives has already been done and configured in
974 Bacula.
975
976 The +BEXTRACT_VOLUME+ variable is optional and is only displayed in the
977 restore instructions on screen as an aid during recovery.
978
979
980 ==== Making the OBDR rescue tape
981 To create a rescue environment that can boot from an OBDR tape, simply run
982 +rear -v mkrescue+ with a *REAR-000* -labeled tape inserted.
983
984 ----
985 [root@system ~]# rear -v mkrescue
986 Relax-and-Recover 1.12.0svn497 / 2011-07-11
987 Rewinding tape
988 Writing OBDR header to tape in drive '/dev/nst0'
989 Creating disk layout.
990 Creating root filesystem layout
991 Copying files and directories
992 Copying program files and libraries
993 Copying kernel modules
994 Creating initramfs
995 Making ISO image
996 Wrote ISO image: /var/lib/rear/output/rear-dag-ops.iso (48M)
997 Writing ISO image to tape
998 Modifying local GRUB configuration
999 Finished in 119 seconds.
1000 ----
1001
1002 WARNING: The message above about _/dev/cciss/c1d0_ not being used makes sense
1003 as this is not a real disk but simply an entry for manipulating the controller.
1004 This is specific to CCISS controllers with only a tape device attached.
1005
1006
1007 [[booting-from-obdr]]
1008 ==== Booting from OBDR rescue tape
1009 The One Button Disaster Recovery (OBDR) functionality in HP LTO Ultrium drives
1010 enables them to emulate CD-ROM devices in specific circumstances (also known
1011 as being in ''Disaster Recovery'' mode). The drive can then act as a boot
1012 device for PCs that support booting off CD-ROM.
1013
1014 TIP: An OBDR capable drive can be switched into CD-ROM mode by *powering on
1015 with the eject button held down*. Make sure you keep it pressed when the
1016 tape drive regains power, and then release the button. If the drive is in
1017 OBDR mode, the light will blink regularly. This might be easier in some
1018 cases than the below procedure, hence the name One Button Disaster
1019 Recovery !
1020
1021
1022 ===== Using a HP Smart Array controller
1023 To boot from OBDR, boot your system with the Relax-and-Recover tape inserted.
1024 During the boot sequence, interrupt the HP Smart Array controller with the
1025 tape attached by pressing *F8* (or *Escape-8* on serial console).
1026
1027 ----
1028 iLO 2 v1.78 Jun 10 2009 10.5.20.171
1029
1030 Slot 0 HP Smart Array P410i Controller (512MB, v2.00) 1 Logical Drive
1031 Slot 3 HP Smart Array P401 Controller (512MB, v2.00) 1 Logical Drive
1032 Slot 4 HP Smart Array P212 Controller (0MB, v2.00) 0 Logical Drives
1033 Tape or CD-ROM Drive(s) Detected:
1034 Port 1I: Box 0: Bay 4
1035 1785-Slot 4 Drive Array Not Configured
1036 No Drives Detected
1037
1038
1039 Press <F8> to run the Option ROM Configuration for Arrays Utility
1040 Press <ESC> to skip configuration and continue
1041 ----
1042
1043 Then select *Configure OBDR* in the menu and select the Tape drive by marking
1044 it with *X* (default is on) and press *ENTER* and *F8* to activate this change
1045 so it displays ''Configuration saved''.
1046
1047 Then press *ENTER* and *Escape* to leave the Smart Array controller BIOS.
1048
1049 ----
1050 **** System will boot from Tape/CD/OBDR device attached to Smart Array.
1051 ----
1052
1053
1054 ===== Using an LSI controller
1055 To boot from OBDR when using an LSI controller, boot your system with the
1056 Relax-and-Recover tape inserted. During the boot sequence, interrupt the
1057 LSI controller BIOS that has the tape attached by pressing *F8* (or
1058 *Escape-8* on serial console).
1059
1060 ----
1061 LSI Logic Corp. MPT BIOS
1062 Copyright 1995-2006 LSI Logic Corp.
1063 MPTBIOS-5.05.21.00
1064 HP Build
1065
1066 <<<Press F8 for configuration options>>>
1067 ----
1068
1069 Then select the option +1. Tape-based One Button Disaster Recovery (OBDR).+:
1070
1071 ----
1072 Select a configuration option:
1073 1. Tape-based One Button Disaster Recovery (OBDR).
1074 2. Multi Initiator Configuration. <F9 = Setup>
1075 3. Exit.
1076 ----
1077
1078 And then select the correct tape drive to boot from:
1079
1080 ----
1081 compatible tape drives found ->
1082 NUM HBA SCSI ID Drive information
1083 0 0 A - HP Ultrium 2-SCSI
1084
1085 Please choose the NUM of the tape drive to place into OBDR mode.
1086 ----
1087
1088 If all goes well, the system will reboot with OBDR-mode enabled:
1089
1090 ----
1091 The PC will now reboot to begin Tape Recovery....
1092 ----
1093
1094 During the next boot, OBDR-mode will be indicate by:
1095
1096 ----
1097 *** Bootable media located, Using non-Emulation mode ***
1098 ----
1099
1100
1101 ===== Booting the OBDR tape
1102 Once booted from the OBDR tape, select the 'Relax-and-Recover' menu entry from
1103 the menu. If you don't press a key within 30 seconds, the system will try to
1104 boot from the local disk.
1105
1106 ["aafigure",width="12cm",height="6cm",align="center",format="svg",options="textual",aspect="0.7",linewidth="1"]
1107 ----
1108 +---------------------------------------------+
1109 | "Relax-and-Recover v1.12.0svn497" |
1110 +---------------------------------------------+
1111 | "Relax-and-Recover" |
1112 |---------------------------------------------|
1113 | "Other actions" |
1114 | "Help for Relax-and-Recover" |
1115 | "Boot Local disk (hd1)" |
1116 | "Boot BIOS disk (0x81)" |
1117 | "Boot Next BIOS device" |
1118 | "Hardware Detection tool" |
1119 | "Memory test" |
1120 | "Reboot system" |
1121 | "Power off system" |
1122 | |
1123 | |
1124 +---------------------------------------------+
1125
1126 "Press [Tab] to edit options or [F1] for help"
1127
1128 "Automatic boot in 30 seconds..."
1129 ----
1130
1131 ////
1132 .-------------------------------------------------------------.
1133 | Relax-and-Recover v1.12.0svn497 |
1134 |-------------------------------------------------------------|
1135 | Relax-and-Recover |
1136 |-------------------------------------------------------------|
1137 | Other actions |
1138 | Help for Relax-and-Recover |
1139 (> Boot Local disk (hd0) <)
1140 | Boot BIOS disk (0x80) |
1141 | Boot Next BIOS device |
1142 | Hardware Detection tool |
1143 | Memory test |
1144 | Reboot system |
1145 | Power off system |
1146 `-------------------------------------------------------------'
1147
1148 Press [Tab] to edit options or [F1] for help
1149
1150 Automatic boot in 30 seconds...
1151 ////
1152
1153
1154 ==== Restoring the OBDR rescue tape
1155 Then wait for the system to boot until you get the prompt.
1156
1157 On the shell prompt, type +rear recover+.
1158
1159 You may need to answer a few questions depending on your hardware
1160 configuration and whether you are restoring to a (slightly)
1161 different system.
1162
1163 ----
1164 RESCUE SYSTEM:/ # rear recover
1165 Relax-and-Recover 1.12.0svn497 / 2011-07-11
1166 NOTICE: Will do driver migration
1167 Rewinding tape
1168 To recreate HP SmartArray controller 3, type exactly YES: YES
1169 To recreate HP SmartArray controller 0, type exactly YES: YES
1170 Clearing HP SmartArray controller 3
1171 Clearing HP SmartArray controller 0
1172 Recreating HP SmartArray controller 3|A
1173 Configuration restored successfully, reloading CCISS driver... OK
1174 Recreating HP SmartArray controller 0|A
1175 Configuration restored successfully, reloading CCISS driver... OK
1176 Comparing disks.
1177 Disk configuration is identical, proceeding with restore.
1178 Type "Yes" if you want DRBD resource rBCK to become primary: Yes
1179 Type "Yes" if you want DRBD resource rOPS to become primary: Yes
1180 Start system layout restoration.
1181 Creating partitions for disk /dev/cciss/c0d0 (msdos)
1182 Creating partitions for disk /dev/cciss/c2d0 (msdos)
1183 Creating software RAID /dev/md2
1184 Creating software RAID /dev/md6
1185 Creating software RAID /dev/md3
1186 Creating software RAID /dev/md4
1187 Creating software RAID /dev/md5
1188 Creating software RAID /dev/md1
1189 Creating software RAID /dev/md0
1190 Creating LVM PV /dev/md6
1191 Creating LVM PV /dev/md5
1192 Creating LVM PV /dev/md2
1193 Creating LVM VG vgrem
1194 Creating LVM VG vgqry
1195 Creating LVM VG vg00
1196 Creating LVM volume vg00/lv00
1197 Creating LVM volume vg00/lvdstpol
1198 Creating LVM volume vg00/lvsys
1199 Creating LVM volume vg00/lvusr
1200 Creating LVM volume vg00/lvtmp
1201 Creating LVM volume vg00/lvvar
1202 Creating LVM volume vg00/lvopt
1203 Creating ext3-filesystem / on /dev/mapper/vg00-lv00
1204 Mounting filesystem /
1205 Creating ext3-filesystem /dstpol on /dev/mapper/vg00-lvdstpol
1206 Mounting filesystem /dstpol
1207 Creating ext3-filesystem /dstpol/sys on /dev/mapper/vg00-lvsys
1208 Mounting filesystem /dstpol/sys
1209 Creating ext3-filesystem /usr on /dev/mapper/vg00-lvusr
1210 Mounting filesystem /usr
1211 Creating ext2-filesystem /tmp on /dev/mapper/vg00-lvtmp
1212 Mounting filesystem /tmp
1213 Creating ext3-filesystem /boot on /dev/md0
1214 Mounting filesystem /boot
1215 Creating ext3-filesystem /var on /dev/mapper/vg00-lvvar
1216 Mounting filesystem /var
1217 Creating ext3-filesystem /opt on /dev/mapper/vg00-lvopt
1218 Mounting filesystem /opt
1219 Creating swap on /dev/md1
1220 Creating DRBD resource rBCK
1221 Writing meta data...
1222 initializing activity log
1223 New drbd meta data block successfully created.
1224 Creating LVM PV /dev/drbd2
1225 Creating LVM VG vgbck
1226 Creating LVM volume vgbck/lvetc
1227 Creating LVM volume vgbck/lvvar
1228 Creating LVM volume vgbck/lvmysql
1229 Creating ext3-filesystem /etc/bacula/cluster on /dev/mapper/vgbck-lvetc
1230 Mounting filesystem /etc/bacula/cluster
1231 Creating ext3-filesystem /var/bacula on /dev/mapper/vgbck-lvvar
1232 Mounting filesystem /var/bacula
1233 Creating ext3-filesystem /var/lib/mysql/bacula on /dev/mapper/vgbck-lvmysql
1234 Mounting filesystem /var/lib/mysql/bacula
1235 Creating DRBD resource rOPS
1236 Writing meta data...
1237 initializing activity log
1238 New drbd meta data block successfully created.
1239 Creating LVM PV /dev/drbd1
1240 Creating LVM VG vgops
1241 Creating LVM volume vgops/lvcachemgr
1242 Creating LVM volume vgops/lvbackup
1243 Creating LVM volume vgops/lvdata
1244 Creating LVM volume vgops/lvdb
1245 Creating LVM volume vgops/lvswl
1246 Creating LVM volume vgops/lvcluster
1247 Creating ext3-filesystem /opt/cache on /dev/mapper/vgops-lvcachemgr
1248 Mounting filesystem /opt/cache
1249 Creating ext3-filesystem /dstpol/backup on /dev/mapper/vgops-lvbackup
1250 Mounting filesystem /dstpol/backup
1251 Creating ext3-filesystem /dstpol/data on /dev/mapper/vgops-lvdata
1252 Mounting filesystem /dstpol/data
1253 Creating ext3-filesystem /dstpol/databases on /dev/mapper/vgops-lvdb
1254 Mounting filesystem /dstpol/databases
1255 Creating ext3-filesystem /dstpol/swl on /dev/mapper/vgops-lvswl
1256 Mounting filesystem /dstpol/swl
1257 Creating ext3-filesystem /dstpol/sys/cluster on /dev/mapper/vgops-lvcluster
1258 Mounting filesystem /dstpol/sys/cluster
1259 Disk layout created.
1260
1261 The system is now ready to restore from Bacula. You can use the 'bls' command
1262 to get information from your Volume, and 'bextract' to restore jobs from your
1263 Volume. It is assumed that you know what is necessary to restore - typically
1264 it will be a full backup.
1265
1266 You can find useful Bacula commands in the shell history. When finished, type
1267 'exit' in the shell to continue recovery.
1268
1269 WARNING: The new root is mounted under '/mnt/local'.
1270
1271 rear>
1272 ----
1273
1274
1275 ==== Restoring from Bacula tape
1276 See the section <<restoring-from-bacula-tape,Restoring from Bacula tape>>
1277 for more information about how to restore a Bacula tape.
1278
1279
1280 === OBDR tapes as backup media
1281 An OBDR backup tape is similar to an OBDR rescue tape, but next to the rescue
1282 environment, it also consists of a complete backup of the system. This is
1283 very convenient in that a single tape can be use for disaster recovery, and
1284 recovery is much more simple and completely automated.
1285
1286 CAUTION: Please make sure that the system fits onto a single tape uncompressed.
1287 For an LTO4 Ultrium that would mean no more than 1.6TB.
1288
1289
1290 ==== Configuring Relax-and-Recover for OBDR backup tapes
1291 The below configuration (_/etc/rear/local.conf_) gives a list of possible
1292 options when you want to run Relax-and-Recover with a tape drive. This example
1293 shows how to use the tape for storing *both* the rescue image and the backup.
1294
1295 [source,bash]
1296 ----
1297 BACKUP=NETFS
1298 OUTPUT=OBDR
1299 TAPE_DEVICE=/dev/nst0
1300 ----
1301
1302
1303 ==== Making the OBDR backup tape
1304 To create a bootable backup tape that can boot from OBDR, simply run
1305 +rear -v mkbackup+ with a *REAR-000* -labeled tape inserted.
1306
1307 ----
1308 [root@system ~]# rear -v mkbackup
1309 Relax-and-Recover 1.12.0svn497 / 2011-07-11
1310 Rewinding tape
1311 Writing OBDR header to tape in drive '/dev/nst0'
1312 Creating disk layout
1313 Creating root filesystem layout
1314 Copying files and directories
1315 Copying program files and libraries
1316 Copying kernel modules
1317 Creating initramfs
1318 Making ISO image
1319 Wrote ISO image: /var/lib/rear/output/rear-system.iso (45M)
1320 Writing ISO image to tape
1321 Creating archive '/dev/nst0'
1322 Total bytes written: 7834132480 (7.3GiB, 24MiB/s) in 317 seconds.
1323 Rewinding tape
1324 Modifying local GRUB configuration
1325 Finished in 389 seconds.
1326 ----
1327
1328 IMPORTANT: It is advised to go into single user mode (+init 1+) before creating
1329 a backup to ensure all active data is consistent on disk (and no
1330 important processes are active in memory)
1331
1332
1333 ==== Booting from OBDR backup tape
1334 See the section <<booting-from-obdr,Booting from OBDR rescue tape>> for more
1335 information about how to enable OBDR and boot from OBDR tapes.
1336
1337
1338 ==== Restoring from OBDR backup tape
1339
1340 ----
1341 RESCUE SYSTEM:~ # rear recover
1342 Relax-and-Recover 1.12.0svn497 / 2011-07-11
1343 NOTICE: Will do driver migration
1344 Rewinding tape
1345 To recreate HP SmartArray controller 3, type exactly YES: YES
1346 To recreate HP SmartArray controller 0, type exactly YES: YES
1347 Clearing HP SmartArray controller 3
1348 Clearing HP SmartArray controller 0
1349 Recreating HP SmartArray controller 3|A
1350 Configuration restored successfully, reloading CCISS driver... OK
1351 Recreating HP SmartArray controller 0|A
1352 Configuration restored successfully, reloading CCISS driver... OK
1353 Comparing disks.
1354 Disk configuration is identical, proceeding with restore.
1355 Type "Yes" if you want DRBD resource rBCK to become primary: Yes
1356 Type "Yes" if you want DRBD resource rOPS to become primary: Yes
1357 Start system layout restoration.
1358 Creating partitions for disk /dev/cciss/c0d0 (msdos)
1359 Creating partitions for disk /dev/cciss/c2d0 (msdos)
1360 Creating software RAID /dev/md2
1361 Creating software RAID /dev/md6
1362 Creating software RAID /dev/md3
1363 Creating software RAID /dev/md4
1364 Creating software RAID /dev/md5
1365 Creating software RAID /dev/md1
1366 Creating software RAID /dev/md0
1367 Creating LVM PV /dev/md6
1368 Creating LVM PV /dev/md5
1369 Creating LVM PV /dev/md2
1370 Restoring LVM VG vgrem
1371 Restoring LVM VG vgqry
1372 Restoring LVM VG vg00
1373 Creating ext3-filesystem / on /dev/mapper/vg00-lv00
1374 Mounting filesystem /
1375 Creating ext3-filesystem /dstpol on /dev/mapper/vg00-lvdstpol
1376 Mounting filesystem /dstpol
1377 Creating ext3-filesystem /dstpol/sys on /dev/mapper/vg00-lvsys
1378 Mounting filesystem /dstpol/sys
1379 Creating ext3-filesystem /usr on /dev/mapper/vg00-lvusr
1380 Mounting filesystem /usr
1381 Creating ext2-filesystem /tmp on /dev/mapper/vg00-lvtmp
1382 Mounting filesystem /tmp
1383 Creating ext3-filesystem /boot on /dev/md0
1384 Mounting filesystem /boot
1385 Creating ext3-filesystem /var on /dev/mapper/vg00-lvvar
1386 Mounting filesystem /var
1387 Creating ext3-filesystem /opt on /dev/mapper/vg00-lvopt
1388 Mounting filesystem /opt
1389 Creating swap on /dev/md1
1390 Creating DRBD resource rBCK
1391 Writing meta data...
1392 initializing activity log
1393 New drbd meta data block successfully created.
1394 Creating LVM PV /dev/drbd2
1395 Restoring LVM VG vgbck
1396 Creating ext3-filesystem /etc/bacula/cluster on /dev/mapper/vgbck-lvetc
1397 Mounting filesystem /etc/bacula/cluster
1398 Creating ext3-filesystem /var/bacula on /dev/mapper/vgbck-lvvar
1399 Mounting filesystem /var/bacula
1400 Creating ext3-filesystem /var/lib/mysql/bacula on /dev/mapper/vgbck-lvmysql
1401 Mounting filesystem /var/lib/mysql/bacula
1402 Creating DRBD resource rOPS
1403 Writing meta data...
1404 initializing activity log
1405 New drbd meta data block successfully created.
1406 Creating LVM PV /dev/drbd1
1407 Restoring LVM VG vgops
1408 Creating ext3-filesystem /opt/cache on /dev/mapper/vgops-lvcachemgr
1409 Mounting filesystem /opt/cache
1410 Creating ext3-filesystem /dstpol/backup on /dev/mapper/vgops-lvbackup
1411 Mounting filesystem /dstpol/backup
1412 Creating ext3-filesystem /dstpol/data on /dev/mapper/vgops-lvdata
1413 Mounting filesystem /dstpol/data
1414 Creating ext3-filesystem /dstpol/databases on /dev/mapper/vgops-lvdb
1415 Mounting filesystem /dstpol/databases
1416 Creating ext3-filesystem /dstpol/swl on /dev/mapper/vgops-lvswl
1417 Mounting filesystem /dstpol/swl
1418 Creating ext3-filesystem /dstpol/sys/cluster on /dev/mapper/vgops-lvcluster
1419 Mounting filesystem /dstpol/sys/cluster
1420 Disk layout created.
1421 Restoring from 'tape:///dev/nst0/system/backup.tar'
1422 Restored 7460 MiB in 180 seconds [avg 42444 KiB/sec]
1423 Installing GRUB boot loader
1424
1425 Finished recovering your system. You can explore it under '/mnt/local'.
1426
1427 Finished in 361 seconds.
1428 ----
1429
1430 == Using ReaR to mount and repair your system
1431 Instead of using your ReaR image to completely recover your system from bare
1432 metal (as illustrated in most of the above scenarios), you can also use it
1433 as a live media to boot a broken but hopefully repairable system.
1434
1435 Once booted on your recovery image, the `mountonly` workflow will:
1436
1437 * activate all Volume Groups
1438
1439 * offer to decrypt any LUKS-encrypted filesystem that may be present
1440
1441 * mount all the target filesystems (including the most important virtual
1442 ones) below `/mnt/local`
1443
1444 thereby making it possible for you to explore your system at will,
1445 correcting any configuration mistake that may have prevented its startup,
1446 or allowing you to simply `chroot` into it and further repair it using its
1447 own administrative tools.
1448
1449 One important point to remember is that the `mountonly` workflow on its own
1450 won't modify the target system in any way. Of course, once the target
1451 filesystems are mounted you, as the administrator, may decide to do so
1452 manually.
1453
1454 **Beware:** The `mountonly` workflow can only be used on the system where
1455 the rescue image was generated, as it bases its logic on the filesystem
1456 layout description file generated during the run of the `mkrescue` or
1457 `mkbackup` workflows.
1458
1459 Here are the steps you would typically follow:
1460
1461 === Create your recovery image
1462 Using any of the techniques described in the other scenarios, create a
1463 ReaR recovery image for your system (through `rear mkrescue` or `rear
1464 mkbackup`). If you only take the `mountonly` workflow into consideration, it
1465 doesn't matter whether you also make a backup of your system or not
1466 (obviously, you'd better cover all your bases and make sure you'd be able to
1467 perform a full `recover` as well should the need occur).
1468
1469 Please note, that by default ReaR only includes in the recovery image the
1470 tools it will need to recover the system. If you anticipate the need for
1471 some extra tools in the context of a repair operation (e.g. tools that you
1472 might need in the event `chroot`ing into the target system doesn't work), you
1473 should make sure to include them in your recovery image by adding to the
1474 `PROGS` or `REQUIRED_PROGS` configuration variables (please refer to the
1475 comments in `default.conf` for the exact meaning of each).
1476
1477 === Booting on the recovery image
1478 Arrange for the target system to boot on your recovery image as you would in
1479 any of the other scenarios.
1480
1481 === Launching the "mount only" workflow
1482 Issue the `rear mountonly` command to launch the workflow (that one is always
1483 verbose):
1484
1485 ----
1486 RESCUE pc-pan:~ # rear mountonly
1487 Relax-and-Recover 2.5 / Git
1488 Running rear mountonly (PID 625)
1489 Using log file: /var/log/rear/rear-pc-pan.log
1490 Running workflow mountonly within the ReaR rescue/recovery system
1491 Comparing disks
1492 Device sda has expected (same) size 34359738368 (will be used for 'mountonly')
1493 Disk configuration looks identical
1494 Proceed with 'mountonly' (yes) otherwise manual disk layout configuration is enforced
1495 (default 'yes' timeout 30 seconds)
1496 yes
1497 User confirmed to proceed with 'mountonly'
1498 Start target system mount.
1499 Mounting filesystem /
1500 Mounting filesystem /home
1501 Mounting filesystem /boot/efi
1502 Please enter the password for LUKS device cr_vg00-lvol4 (/dev/mapper/vg00-lvol4):
1503 Enter passphrase for /dev/mapper/vg00-lvol4:
1504 Mounting filesystem /products
1505 Disk layout processed.
1506 Finished 'mountonly'. The target system is mounted at '/mnt/local'.
1507 Exiting rear mountonly (PID 625) and its descendant processes ...
1508 Running exit tasks
1509 ----
1510
1511 As you can see in the output above, you will first be asked to confirm
1512 running the workflow (`Proceed with 'mountonly'`) -- simply press return.
1513 All the target filesystems should now be mounted below `/mnt/local` (including
1514 LUKS-encrypted ones if present and all needed virtual ones). In case any of
1515 them fails to mount, you will be offered to review the mount script and to
1516 re-execute it if needed.
1517
1518 Once the system is in the desired state, you can start exploring it, correcting
1519 any configuration mistake or filesystem corruption that prevented it from
1520 booting properly. In this state, the only tools at your disposal are those
1521 included by default in ReaR recovery image, or those you saw fit to add
1522 yourself (see above).
1523
1524 If this is not enough and you need to run the native administrative tools
1525 hosted inside your target system (such as YaST in the case of SUSE
1526 distributions), you are now in a position where you can `chroot` inside
1527 your system to reach them (`chroot /mnt/local`).
1528
1529 === Closing the session
1530 Once done, don't forget to leave the `chroot` environment if applicable
1531 (Ctrl-D), then issue the `shutdown` command. This will ensure that all the
1532 target filesystems will be cleanly unmounted before the system is restarted.