SlideShare a Scribd company logo
Relax and Recover




Linux Disaster Recovery best
      practices with rear
          Gratien D'haese
          IT3 Consultants
Who am I


 ●   Independent Unix System Engineer since 1996
 ●   Unix user since 1986
 ●   Linux user since 1991
 ●   Open Source contributor:
       ●   Make CD-ROM Recovery (mkCDrec)
       ●   Relax and Recover (rear)
       ●   SIM Installation and Logging (similar)
       ●   Adhocracy (adhocr)



2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear          2
Disaster Recovery


   ●
        Business Continuity Planning
         ●
             A business continuity plan specifies how a
             company plans to restore core business
             operations when disasters occur
   ●
        Disaster Recovery
         ●
             Disaster recovery looks specifically at the
             technical aspects of how a company can get back
             into operation using backup facilities


2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                   3
Disaster Recovery Concerns


 ●   Uptime
       ●   Quick restores with minimal or no manual steps
           after the recovery
 ●   Reliability
       ●   Avoid corrupted file systems and that system boots
           after recovery
 ●   Cost
       ●   DR solutions need to be affordable
 ●   Complexity
       ●   DR plans tend to be too complex.

2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear        4
Getting started with Relax and Recover (rear)


●   Download it from
     ●   The official tar-balls
           –   https://github.com/rear/rear/downloads/
     ●   The rear-snapshot rpm's build from Github
           –   http://download.opensuse.org/repositories/Archiving:/Backup
               :/Rear/
     ●   The official source
           –   https://github.com/rear/rear
     ●   The official repo's (Fedora, EPEL and SLES)
           –   yum install rear
           –   zypper install rear
2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear   5
Installation of rear


 ●   E.g. on Fedora 17
     # yum install rear
     Installing:
      rear                             noarch                1.13.0-1.fc17                    fedora       327 k
     Installing for dependencies:
      at                               i686                  3.1.13-7.fc17                    fedora        61   k
      bc                               i686                  1.06.95-6.fc17                   fedora       106   k
      binutils                         i686                  2.22.52.0.1-5.fc17               fedora       3.6   M
      ed                               i686                  1.5-3.fc17                       fedora        72   k
      ethtool                          i686                  2:3.2-2.fc17                     fedora        93   k
      genisoimage                      i686                  1.1.11-10.fc17                   fedora       338   k
      ….
     Install 1 Package (+40 Dependent packages)
     Total download size: 21 M
     Installed size: 65 M
     Is this ok [y/N]: y


 ●   We also need syslinux (and to boot on USB: extlinux)
     # yum install syslinux
 ●   Install nfs-utils, cifs-utils, rsync if required
 ●   Do not forget openssh(-clients)



2012-05-23 | Gratien D'haese            Linux Disaster Recovery best practices with rear                         6
Decide on DR strategy


 ●   Which backup mechanism to use?
       ●   GNU tar, rsync, bacula, commercial backup
           program
 ●   Where will the backups reside?
       ●   NFS share, CIFS share, external USB disk, tape,
           local spare disk
       ●   Remote network location
 ●   How shall we start the rescue image
       ●   Via CDROM (ISO image), tape (OBDR), network
           (PXE), USB disk

2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear              7
Backup Types


 ●   The major backup types available are
       ●   NETFS: NFS, CIFS, USB, TAPE
       ●   RSYNC: rsync method
       ●   REQUESTRESTORE, EXTERNAL
       ●   BACULA (open source backup software)
       ●   DP, NBU, TSM, GALAXY[7] (commercial stuff)
 ●   Some not (yet) implemented backup types (waiting on sponsors)
       ●   NSR (Legato Networker)
       ●   CDROM

2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear              8
BACKUP type NETFS


                                                                 pxelinux                    OUTPUT=PXE
                                                                 network                     BACKUP=NETFS
                isolinux
           OUTPUT=ISO




(NFS|CIFS|local)                                                                  extlinux
disks                                                                  External USB disks
                                  Tape drive




 OUTPUT=ISO                    OUTPUT=OBDR                                OUTPUT=USB
 BACKUP=NETFS                  BACKUP=NETFS                               BACKUP=NETFS


2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                         9
Location BACKUP_URL


 ●   BACKUP=NETFS
 ●   BACKUP_URL can be
       ●   File type: BACKUP_URL=file:///directory/
       ●   NFS type: BACKUP_URL=nfs://nfs-server/directory/
       ●   CIFS type: BACKUP_URL=cifs://samba/directory/
       ●   USB type: BACKUP_URL=usb:///dev/sdc1/directory/
       ●   Tape type: BACKUP_URL=tape:///dev/nst0




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear        10
Backup Program


 ●   BACKUP=NETFS
 ●   /usr/share/rear/conf/default.conf
       ●   By default is BACKUP_PROG=tar
       ●   However, BACKUP_PROG=rsync is possible for
           local attached storage
       ●   BACKUP_PROG_COMPRESS_OPTIONS="--
           gzip"
       ●   BACKUP_PROG_COMPRESS_SUFFIX=".gz"
       ●   BACKUP_PROG_EXCLUDE=( '/tmp/*'
           '/dev/shm/*' )

2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear               11
BACKUP_PROG_COMPRESS_OPTIONS




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear   12
/etc/rear/local.conf


 ●   Define your settings in /etc/rear/local.conf (or /etc/rear/site.conf)
 ●   # grep -v -E '(^#|^$)' /etc/rear/local.conf
     OUTPUT=ISO
     MODULES_LOAD=( vmxnet )
 ●   Add:
     BACKUP=NETFS
     BACKUP_URL=nfs://server/path
 ●   On NFS server backup => /path/$(hostname)/




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                     13
Rear dump

 ●   View system configuration:
     # rear dump
     Relax and Recover 1.13.0 / $Date$
     Dumping out configuration and system information
     This is a 'Linux-x86_64' system, compatible with 'Linux-i386'.
     System definition:
                                         ARCH = Linux-i386
                                           OS = GNU/Linux
                         OS_MASTER_VENDOR =
                        OS_MASTER_VERSION =
                   OS_MASTER_VENDOR_ARCH =
               OS_MASTER_VENDOR_VERSION =
       OS_ MASTER_VENDOR_VERSION_ARCH =
                                  OS_VENDOR = Fedora
                                    OS_VERSION = 16
                           OS_VENDOR_ARCH = Fedora/i386
                        OS_VENDOR_VERSION = Fedora/16

2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear          14
Rear help


 ●   Usage: rear [-dDsSvV] [-r KERNEL] COMMAND [--
     ARGS...]
 ●   Available options:
       ●    -d             debug mode; log debug messages
       ●    -D                 debugscript mode; log every function call
       ●   -r KERNEL kernel version to use; current: '2.6.42.3-
           2.fc15.i686.PAE'
       ●    -s             simulation mode; show what scripts rear would include
       ●    -S             step-by-step mode; acknowledge each script individually
       ●    -v             verbose mode; show more output
       ●    -V             version information

2012-05-23 | Gratien D'haese         Linux Disaster Recovery best practices with rear          15
Rear help


 ●   Usage: rear [-dDsSvV] [-r KERNEL] COMMAND [--
     ARGS...]
 ●   List of commands:
             –   checklayout           check if the disk layout has changed
             –   format                format and label media for use with rear
             –   mkbackup              create rescue media and backup system
             –   mkbackuponly          backup system without creating rescue media
             –   mkrescue              create rescue media only
             –   recover               recover the system; only valid during rescue
             –   savelayout            save the disk layout of the system
             –   shell                 start a bash within rear; development tool


2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear          16
Disaster Recovery in Practice


 ●   Gather system information
 ●   Store the disk layout
       ●   Partitioning, LVM and RAID configuration
       ●   File systems, file system labels ...
       ●   Boot loader (GRUB, LILO, ELILO)
 ●   Make a system backup (OS and user data)
 ●   Create boot-able rescue media with system configuration (and
     optional with backup data)
 ●   All steps are done “online”
                         online



2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear        17
Rear mkrescue


 ●   Will create an ISO image stored as
       ●   /tmp/rear-$(hostname).iso
       ●   On NFS server as /path/$(hostname)/rear-
           $(hostname).iso
 ●   Inspect file /var/lib/rear/layout/disklayout.conf
 ●   Try to boot from the ISO image into the RESCUE system
       ●   Use 'dmesg' to check if devices were found




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear              18
Rear mkbackup


 ●   Create rescue image with backup archive
 ●   Do not forget to browse through the /tmp/rear-$
     (hostname).log file for errors




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear              19
Recovery Process in detail


 ●   Boot system from rescue media
 ●   Restore disk layout
       ●   Create partitions, RAID configuration and LVM
       ●   Create file systems (mkfs, mkswap)
       ●   Configure file systems (labels, mount points)
 ●   Restore the backup data
 ●   Restore the boot loader
 ●   Inspect & Reboot




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear          20
Recover with rear (1)


 ●   Boot rescue image and select 'recover'




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                21
Recover with rear (2)


 ●   Wait until you see the login prompt




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                22
Recover with rear (3)




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                23
Recover with rear (4)




 ●   Ready? Reboot (shutdown -r 0)
 ●   That's it – wait a while for the selinux relabeling
 ●   Verify the restored system
2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                24
Cloning with rear (1)


 ●   Start the recover process: rear -v recover




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                 25
Cloning with rear (2)




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                 26
Cloning with rear (3)




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                 27
Cloning with rear (4)




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                 28
Cloning with rear (5)




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                 29
Cloning with rear (6)




      So you better know what you're doing, right?
      The BACKUP variable was not set in the /etc/rear/local.conf
      configuration file!

2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                 30
Get your hands dirty?


 ●   We hope you want to dig deeper into rear!
 ●   Getting started:
       ●   Use: rear -s mkbackup
           to see the flow of the scripts it will execute
       ●   Depends on BACKUP method, architecture and OS
           version/brand
       ●   Be careful: rear -s recover
           follows a different flow (seems logically, but you
           must understand the difference)



2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear               31
Where is the code?


 ●   Main script is /usr/sbin/rear
 ●   All the other scripts live under /usr/share/rear
 ●
     Documentation is at /usr/share/doc/rear-x.y.z
 ●   Good news! It's all written in Bash




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear                   32
Where to put a script?


 ●    mkbackup method: /usr/share/rear/...
       ●    conf/ - configuration files (/etc/rear/*.conf read last)
       ●    prep/ - preparation work; checking the environment
       ●    layout/save/ - save the disk layout /var/lib/rear/layout
       ●    rescue/ - modules, network, storage,...
       ●    build/ - populate the initial ramdisk for our rescue image
       ●    pack/ - create the initrd and copy kernel
       ●    output/ - create the ISO image and copy to
            OUTPUT_URL
       ●    backup/ - make the backup archive to BACKUP_URL

2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear               33
Where to put a script? (2)


 ●   recover method: /usr/share/rear/...
       ●   conf/ - read the configuration file + /etc/rear/*.conf
       ●   setup/ - user defined scripts to run before recover
       ●   verify/ - to check if a recover is possible at all
       ●   layout/prepare – recreate the disk layout
       ●   restore/ - restore the archive from BACKUP_URL
       ●   finalize/ - do some dirty tricks for disks, grub,...
       ●   wrapup/ - copy the recover log to /mnt/local/root/



2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear            34
Example script: sysreqs.sh


 ●   A simple script to save basic system requirements – sysreqs.sh
       ●   OS version; rear version
       ●   CPU, memory
       ●   Disk space requirements
       ●   IP addresses in use; routes
 ●   Copy sysreqs.sh to a flow, e.g. rescue is a good choice
       ●   # cp /tmp/sysreqs.sh 
           /usr/share/rear/rescue/GNU/Linux/96_sysreqs.sh



2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear          35
Test the script


   ●   # rear -s mkrescue | grep sysreqs
       Source rescue/GNU/Linux/96_sysreqs.sh
   ●   # rear -v mkrescue
   ●   # cat /var/lib/rear/sysreqs/Minimal_System_Requirements.txt
       fedora - 2012-05-22 11:26
       Operating system:
       LSB Version:    :core-4.0-ia32:core-4.0-noarch
       Distributor ID: Fedora
       Description:    Fedora release 16 (Verne)
       Release:        16
       Codename:       Verne
       Relax and recover version:
       Relax and Recover 1.13.0 / $Date$

       There are 1 CPU core(s) at   2393.832 MHz
       748 MiB of physical memory

       Disk space requirements:
         OS (vg + swap + /boot)
           size: 6.09 GiB

       Network Information:
         IP adresses:
           ip 6 ::1 subnet /128 scope host DNS name
           ip 192.168.5.135 subnet /24 DNS name
           ip 6 fe80::20c:29ff:fe63:5cd0 subnet /64 scope link DNS name
2012-05-23 | Gratien D'haese        Linux Disaster Recovery best practices with rear                36
https://github.com/rear/rear/issues




2012-05-23 | Gratien D'haese   Linux Disaster Recovery best practices with rear      37
Contacts



                     Web-site: http://rear.github.com/
                     GitHib: https://github.com/rear/rear
                     Mailing list: rear-users@lists.sourceforge.net

                      Rear Maintainer - Gratien D'haese - gratien.dhaese@it3.be

                    Rear Maintainer - Schlomo Schapiro - schlomo@schapiro.org

                      Rear Developer – Jeroen Hoekx - jeroen.hoekx@hamok.be

                               Rear Developer – Dag Wieers - dag@wieers.com




2012-05-23 | Gratien D'haese         Linux Disaster Recovery best practices with rear         38

More Related Content

What's hot (20)

PDF
Kernel Configuration and Compilation
Bud Siddhisena
 
PDF
Open Source Backup Conference 2014: Rear, by Ralf Dannert
NETWAYS
 
PPTX
How to install gentoo distributed
SongWang54
 
PDF
Asiabsdcon14
Dru Lavigne
 
PDF
Ilf2012
Dru Lavigne
 
PDF
Systemd for developers
Alison Chaiken
 
PDF
Asiabsdcon14 lavigne
Dru Lavigne
 
PDF
Lavigne bsdmag july
Dru Lavigne
 
PDF
Tlf2014
Dru Lavigne
 
PDF
F17 inside
Teguh Dwicaksana
 
PDF
Ilf2011
Dru Lavigne
 
PDF
Lavigne sept11 bsdmag
Dru Lavigne
 
PDF
Linux admin course
Manikanta Pushadapu
 
PPT
Rhce ppt
Mohammed Ben
 
PDF
RunX ELCE 2020
Stefano Stabellini
 
PDF
RunX: deploy real-time OSes as containers at the edge
Stefano Stabellini
 
PDF
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
linuxlab_conf
 
Kernel Configuration and Compilation
Bud Siddhisena
 
Open Source Backup Conference 2014: Rear, by Ralf Dannert
NETWAYS
 
How to install gentoo distributed
SongWang54
 
Asiabsdcon14
Dru Lavigne
 
Ilf2012
Dru Lavigne
 
Systemd for developers
Alison Chaiken
 
Asiabsdcon14 lavigne
Dru Lavigne
 
Lavigne bsdmag july
Dru Lavigne
 
Tlf2014
Dru Lavigne
 
F17 inside
Teguh Dwicaksana
 
Ilf2011
Dru Lavigne
 
Lavigne sept11 bsdmag
Dru Lavigne
 
Linux admin course
Manikanta Pushadapu
 
Rhce ppt
Mohammed Ben
 
RunX ELCE 2020
Stefano Stabellini
 
RunX: deploy real-time OSes as containers at the edge
Stefano Stabellini
 
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
linuxlab_conf
 

Viewers also liked (9)

PDF
100% Backup: Reload & Reload for Retain Deep Dive
GWAVA
 
PDF
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbegan
Tobias Koprowski
 
PDF
KoprowskiT - SQLBITS X - 2am a disaster just began
Tobias Koprowski
 
PPTX
Develop a Business Continuity Plan
Info-Tech Research Group
 
PDF
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
Symantec
 
PDF
Best Practices in Disaster Recovery Planning and Testing
Axcient
 
PPTX
Red hat enterprise linux 7 (rhel 7)
Ramola Dhande
 
PPT
Red Hat Enterprise Linux 7
Mazenetsolution
 
ODP
Introduction to Red Hat
Albert Wong
 
100% Backup: Reload & Reload for Retain Deep Dive
GWAVA
 
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbegan
Tobias Koprowski
 
KoprowskiT - SQLBITS X - 2am a disaster just began
Tobias Koprowski
 
Develop a Business Continuity Plan
Info-Tech Research Group
 
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
Symantec
 
Best Practices in Disaster Recovery Planning and Testing
Axcient
 
Red hat enterprise linux 7 (rhel 7)
Ramola Dhande
 
Red Hat Enterprise Linux 7
Mazenetsolution
 
Introduction to Red Hat
Albert Wong
 
Ad

Similar to LinuxTag2012 Rear (20)

PDF
Intro to Kernel Debugging - Just make the crashing stop!
All Things Open
 
PDF
Asiabsdcon2013
krispcbsd
 
PDF
The implementation of ldrp (with rear)
loadays
 
PDF
Relax and Recover on POWER (Updated 05-2017)
Sebastien Chabrolles
 
PDF
Kernel Recipes 2015 - Hardened kernels for everyone
Anne Nicolas
 
PDF
Strategies for developing and deploying your embedded applications and images
Mender.io
 
PDF
A million ways to provision embedded linux devices
Mender.io
 
PDF
Hands on with embedded linux using zero hardware
Rajesh Sola
 
PDF
"Relax and Recover", an Open Source mksysb for Linux on Power
Sebastien Chabrolles
 
PDF
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Opersys inc.
 
PDF
Leveraging Android's Linux Heritage at AnDevCon VI
Opersys inc.
 
PPT
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan Baljevic
Circling Cycle
 
PDF
Embedded linux build systems
Mender.io
 
PDF
Leveraging Android's Linux Heritage at AnDevCon V
Opersys inc.
 
PDF
Building Mini Embedded Linux System for X86 Arch
Sherif Mousa
 
PDF
An Introduction To Linux
Ishan A B Ambanwela
 
ODP
Linux Capabilities - eng - v2.1.5, compact
Alessandro Selli
 
PPTX
Introduction to docker
Christophe Muller
 
PDF
Docker containers : introduction
rinnocente
 
ODP
Description of GRUB 2
iamumr
 
Intro to Kernel Debugging - Just make the crashing stop!
All Things Open
 
Asiabsdcon2013
krispcbsd
 
The implementation of ldrp (with rear)
loadays
 
Relax and Recover on POWER (Updated 05-2017)
Sebastien Chabrolles
 
Kernel Recipes 2015 - Hardened kernels for everyone
Anne Nicolas
 
Strategies for developing and deploying your embedded applications and images
Mender.io
 
A million ways to provision embedded linux devices
Mender.io
 
Hands on with embedded linux using zero hardware
Rajesh Sola
 
"Relax and Recover", an Open Source mksysb for Linux on Power
Sebastien Chabrolles
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Opersys inc.
 
Leveraging Android's Linux Heritage at AnDevCon VI
Opersys inc.
 
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan Baljevic
Circling Cycle
 
Embedded linux build systems
Mender.io
 
Leveraging Android's Linux Heritage at AnDevCon V
Opersys inc.
 
Building Mini Embedded Linux System for X86 Arch
Sherif Mousa
 
An Introduction To Linux
Ishan A B Ambanwela
 
Linux Capabilities - eng - v2.1.5, compact
Alessandro Selli
 
Introduction to docker
Christophe Muller
 
Docker containers : introduction
rinnocente
 
Description of GRUB 2
iamumr
 
Ad

More from Gratien D'haese (6)

PDF
Open Technology Assemby Open Source Support Program
Gratien D'haese
 
PDF
What did you inspec?
Gratien D'haese
 
PDF
Rear automated testing with Bareos
Gratien D'haese
 
PDF
Relax-and-Recover Automated Testing
Gratien D'haese
 
PDF
Business Continuity Planning with Bareos and rear (Loadays 2015)
Gratien D'haese
 
PDF
Exploring I Pv6
Gratien D'haese
 
Open Technology Assemby Open Source Support Program
Gratien D'haese
 
What did you inspec?
Gratien D'haese
 
Rear automated testing with Bareos
Gratien D'haese
 
Relax-and-Recover Automated Testing
Gratien D'haese
 
Business Continuity Planning with Bareos and rear (Loadays 2015)
Gratien D'haese
 
Exploring I Pv6
Gratien D'haese
 

LinuxTag2012 Rear

  • 1. Relax and Recover Linux Disaster Recovery best practices with rear Gratien D'haese IT3 Consultants
  • 2. Who am I ● Independent Unix System Engineer since 1996 ● Unix user since 1986 ● Linux user since 1991 ● Open Source contributor: ● Make CD-ROM Recovery (mkCDrec) ● Relax and Recover (rear) ● SIM Installation and Logging (similar) ● Adhocracy (adhocr) 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 2
  • 3. Disaster Recovery ● Business Continuity Planning ● A business continuity plan specifies how a company plans to restore core business operations when disasters occur ● Disaster Recovery ● Disaster recovery looks specifically at the technical aspects of how a company can get back into operation using backup facilities 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 3
  • 4. Disaster Recovery Concerns ● Uptime ● Quick restores with minimal or no manual steps after the recovery ● Reliability ● Avoid corrupted file systems and that system boots after recovery ● Cost ● DR solutions need to be affordable ● Complexity ● DR plans tend to be too complex. 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 4
  • 5. Getting started with Relax and Recover (rear) ● Download it from ● The official tar-balls – https://github.com/rear/rear/downloads/ ● The rear-snapshot rpm's build from Github – http://download.opensuse.org/repositories/Archiving:/Backup :/Rear/ ● The official source – https://github.com/rear/rear ● The official repo's (Fedora, EPEL and SLES) – yum install rear – zypper install rear 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 5
  • 6. Installation of rear ● E.g. on Fedora 17 # yum install rear Installing: rear noarch 1.13.0-1.fc17 fedora 327 k Installing for dependencies: at i686 3.1.13-7.fc17 fedora 61 k bc i686 1.06.95-6.fc17 fedora 106 k binutils i686 2.22.52.0.1-5.fc17 fedora 3.6 M ed i686 1.5-3.fc17 fedora 72 k ethtool i686 2:3.2-2.fc17 fedora 93 k genisoimage i686 1.1.11-10.fc17 fedora 338 k …. Install 1 Package (+40 Dependent packages) Total download size: 21 M Installed size: 65 M Is this ok [y/N]: y ● We also need syslinux (and to boot on USB: extlinux) # yum install syslinux ● Install nfs-utils, cifs-utils, rsync if required ● Do not forget openssh(-clients) 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 6
  • 7. Decide on DR strategy ● Which backup mechanism to use? ● GNU tar, rsync, bacula, commercial backup program ● Where will the backups reside? ● NFS share, CIFS share, external USB disk, tape, local spare disk ● Remote network location ● How shall we start the rescue image ● Via CDROM (ISO image), tape (OBDR), network (PXE), USB disk 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 7
  • 8. Backup Types ● The major backup types available are ● NETFS: NFS, CIFS, USB, TAPE ● RSYNC: rsync method ● REQUESTRESTORE, EXTERNAL ● BACULA (open source backup software) ● DP, NBU, TSM, GALAXY[7] (commercial stuff) ● Some not (yet) implemented backup types (waiting on sponsors) ● NSR (Legato Networker) ● CDROM 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 8
  • 9. BACKUP type NETFS pxelinux OUTPUT=PXE network BACKUP=NETFS isolinux OUTPUT=ISO (NFS|CIFS|local) extlinux disks External USB disks Tape drive OUTPUT=ISO OUTPUT=OBDR OUTPUT=USB BACKUP=NETFS BACKUP=NETFS BACKUP=NETFS 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 9
  • 10. Location BACKUP_URL ● BACKUP=NETFS ● BACKUP_URL can be ● File type: BACKUP_URL=file:///directory/ ● NFS type: BACKUP_URL=nfs://nfs-server/directory/ ● CIFS type: BACKUP_URL=cifs://samba/directory/ ● USB type: BACKUP_URL=usb:///dev/sdc1/directory/ ● Tape type: BACKUP_URL=tape:///dev/nst0 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 10
  • 11. Backup Program ● BACKUP=NETFS ● /usr/share/rear/conf/default.conf ● By default is BACKUP_PROG=tar ● However, BACKUP_PROG=rsync is possible for local attached storage ● BACKUP_PROG_COMPRESS_OPTIONS="-- gzip" ● BACKUP_PROG_COMPRESS_SUFFIX=".gz" ● BACKUP_PROG_EXCLUDE=( '/tmp/*' '/dev/shm/*' ) 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 11
  • 12. BACKUP_PROG_COMPRESS_OPTIONS 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 12
  • 13. /etc/rear/local.conf ● Define your settings in /etc/rear/local.conf (or /etc/rear/site.conf) ● # grep -v -E '(^#|^$)' /etc/rear/local.conf OUTPUT=ISO MODULES_LOAD=( vmxnet ) ● Add: BACKUP=NETFS BACKUP_URL=nfs://server/path ● On NFS server backup => /path/$(hostname)/ 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 13
  • 14. Rear dump ● View system configuration: # rear dump Relax and Recover 1.13.0 / $Date$ Dumping out configuration and system information This is a 'Linux-x86_64' system, compatible with 'Linux-i386'. System definition: ARCH = Linux-i386 OS = GNU/Linux OS_MASTER_VENDOR = OS_MASTER_VERSION = OS_MASTER_VENDOR_ARCH = OS_MASTER_VENDOR_VERSION = OS_ MASTER_VENDOR_VERSION_ARCH = OS_VENDOR = Fedora OS_VERSION = 16 OS_VENDOR_ARCH = Fedora/i386 OS_VENDOR_VERSION = Fedora/16 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 14
  • 15. Rear help ● Usage: rear [-dDsSvV] [-r KERNEL] COMMAND [-- ARGS...] ● Available options: ● -d debug mode; log debug messages ● -D debugscript mode; log every function call ● -r KERNEL kernel version to use; current: '2.6.42.3- 2.fc15.i686.PAE' ● -s simulation mode; show what scripts rear would include ● -S step-by-step mode; acknowledge each script individually ● -v verbose mode; show more output ● -V version information 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 15
  • 16. Rear help ● Usage: rear [-dDsSvV] [-r KERNEL] COMMAND [-- ARGS...] ● List of commands: – checklayout check if the disk layout has changed – format format and label media for use with rear – mkbackup create rescue media and backup system – mkbackuponly backup system without creating rescue media – mkrescue create rescue media only – recover recover the system; only valid during rescue – savelayout save the disk layout of the system – shell start a bash within rear; development tool 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 16
  • 17. Disaster Recovery in Practice ● Gather system information ● Store the disk layout ● Partitioning, LVM and RAID configuration ● File systems, file system labels ... ● Boot loader (GRUB, LILO, ELILO) ● Make a system backup (OS and user data) ● Create boot-able rescue media with system configuration (and optional with backup data) ● All steps are done “online” online 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 17
  • 18. Rear mkrescue ● Will create an ISO image stored as ● /tmp/rear-$(hostname).iso ● On NFS server as /path/$(hostname)/rear- $(hostname).iso ● Inspect file /var/lib/rear/layout/disklayout.conf ● Try to boot from the ISO image into the RESCUE system ● Use 'dmesg' to check if devices were found 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 18
  • 19. Rear mkbackup ● Create rescue image with backup archive ● Do not forget to browse through the /tmp/rear-$ (hostname).log file for errors 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 19
  • 20. Recovery Process in detail ● Boot system from rescue media ● Restore disk layout ● Create partitions, RAID configuration and LVM ● Create file systems (mkfs, mkswap) ● Configure file systems (labels, mount points) ● Restore the backup data ● Restore the boot loader ● Inspect & Reboot 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 20
  • 21. Recover with rear (1) ● Boot rescue image and select 'recover' 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 21
  • 22. Recover with rear (2) ● Wait until you see the login prompt 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 22
  • 23. Recover with rear (3) 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 23
  • 24. Recover with rear (4) ● Ready? Reboot (shutdown -r 0) ● That's it – wait a while for the selinux relabeling ● Verify the restored system 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 24
  • 25. Cloning with rear (1) ● Start the recover process: rear -v recover 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 25
  • 26. Cloning with rear (2) 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 26
  • 27. Cloning with rear (3) 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 27
  • 28. Cloning with rear (4) 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 28
  • 29. Cloning with rear (5) 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 29
  • 30. Cloning with rear (6) So you better know what you're doing, right? The BACKUP variable was not set in the /etc/rear/local.conf configuration file! 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 30
  • 31. Get your hands dirty? ● We hope you want to dig deeper into rear! ● Getting started: ● Use: rear -s mkbackup to see the flow of the scripts it will execute ● Depends on BACKUP method, architecture and OS version/brand ● Be careful: rear -s recover follows a different flow (seems logically, but you must understand the difference) 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 31
  • 32. Where is the code? ● Main script is /usr/sbin/rear ● All the other scripts live under /usr/share/rear ● Documentation is at /usr/share/doc/rear-x.y.z ● Good news! It's all written in Bash 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 32
  • 33. Where to put a script? ● mkbackup method: /usr/share/rear/... ● conf/ - configuration files (/etc/rear/*.conf read last) ● prep/ - preparation work; checking the environment ● layout/save/ - save the disk layout /var/lib/rear/layout ● rescue/ - modules, network, storage,... ● build/ - populate the initial ramdisk for our rescue image ● pack/ - create the initrd and copy kernel ● output/ - create the ISO image and copy to OUTPUT_URL ● backup/ - make the backup archive to BACKUP_URL 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 33
  • 34. Where to put a script? (2) ● recover method: /usr/share/rear/... ● conf/ - read the configuration file + /etc/rear/*.conf ● setup/ - user defined scripts to run before recover ● verify/ - to check if a recover is possible at all ● layout/prepare – recreate the disk layout ● restore/ - restore the archive from BACKUP_URL ● finalize/ - do some dirty tricks for disks, grub,... ● wrapup/ - copy the recover log to /mnt/local/root/ 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 34
  • 35. Example script: sysreqs.sh ● A simple script to save basic system requirements – sysreqs.sh ● OS version; rear version ● CPU, memory ● Disk space requirements ● IP addresses in use; routes ● Copy sysreqs.sh to a flow, e.g. rescue is a good choice ● # cp /tmp/sysreqs.sh /usr/share/rear/rescue/GNU/Linux/96_sysreqs.sh 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 35
  • 36. Test the script ● # rear -s mkrescue | grep sysreqs Source rescue/GNU/Linux/96_sysreqs.sh ● # rear -v mkrescue ● # cat /var/lib/rear/sysreqs/Minimal_System_Requirements.txt fedora - 2012-05-22 11:26 Operating system: LSB Version: :core-4.0-ia32:core-4.0-noarch Distributor ID: Fedora Description: Fedora release 16 (Verne) Release: 16 Codename: Verne Relax and recover version: Relax and Recover 1.13.0 / $Date$ There are 1 CPU core(s) at 2393.832 MHz 748 MiB of physical memory Disk space requirements: OS (vg + swap + /boot) size: 6.09 GiB Network Information: IP adresses: ip 6 ::1 subnet /128 scope host DNS name ip 192.168.5.135 subnet /24 DNS name ip 6 fe80::20c:29ff:fe63:5cd0 subnet /64 scope link DNS name 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 36
  • 38. Contacts Web-site: http://rear.github.com/ GitHib: https://github.com/rear/rear Mailing list: [email protected] Rear Maintainer - Gratien D'haese - [email protected] Rear Maintainer - Schlomo Schapiro - [email protected] Rear Developer – Jeroen Hoekx - [email protected] Rear Developer – Dag Wieers - [email protected] 2012-05-23 | Gratien D'haese Linux Disaster Recovery best practices with rear 38