RELAX-AND-RECOVER (REAR)

When a software or hardware failure breaks the system, the system administrator faces three tasks to restore it to the fully functioning state on a new hardware environment:
 
1. Booting a rescue system on the new hardware
2. Replicating the original storage layout
3. Restoring user and system files
 
Most backup software solves only the third problem. To solve the first and second problems, use Relax-and-Recover (ReaR), a disaster recovery and system migration utility.
 
Backup software creates backups. ReaR complements backup software by creating a rescue system. Booting the rescue system on a new hardware allows you to issue the rear recover command, which starts the recovery process. During this process, ReaR replicates the partition layout and filesystems, prompts for restoring user and system files from the backup created by backup software, and finally installs the boot loader. By default, the rescue system created by ReaR only restores the storage layout and the boot loader, but not the actual user and system files.
 
Create NFS Server to store the backup image:
1. Installing NFS
[root@cdn01 ~]# yum install nfs-utils
 
2. Create folder to store the backup.
[root@cdn01 ~]#mkdir /var/nfs-share
 
3. Change the permission for folder.
[root@cdn01 ~]##chmod -R 755 /var/nfs-share/
 
4. Update the NFS configiration file.
[root@cdn01 ~]# vi /etc/exports
/var/nfs-share  *(fsid=0,rw,sync,no_root_squash,no_subtree_check,crossmnt)
[root@cdn01 ~]#
 
5. Restart the NFS Server.
[root@cdn01 ~]#systemctl restart nfs-server
 
6. Open NFS port on firewall. 
[root@cdn01 ~]#firewall-cmd --permanent --add-service=nfs
[root@cdn01 ~]#firewall-cmd --add-service=nfs
 
7. Installing ReaR package on client system
[root@cap01 ~]# yum install rear
 
8. Configuring ReaR
ReaR is configured in the /etc/rear/local.conf file. Specify the rescue system configuration by adding these lines:
 
[root@cap01 ~]# vi /etc/rear/local.conf
OUTPUT=ISO
OUTPUT_URL=nfs://cdn01/var/nfs-share
BACKUP=NETFS
BACKUP_URL=nfs://cdn01/var/nfs-share
NETFS_KEEP_OLD_BACKUP_COPY=2
[root@cap01 ~]#
 
9. Creating a backup of System
The following example shows how to create a rescue system with verbose output:
 
[root@cap01 ~]# rear -d -v mkbackup
Relax-and-Recover 2.4 / Git
Using log file: /var/log/rear/rear-cap01.log
Using backup archive '/tmp/rear.IcOaa604mQChxcF/outputfs/cap01/backup.tar.gz'
Creating disk layout
Using guessed bootloader 'GRUB' (found in first bytes on /dev/sda)
Creating root filesystem layout
Handling network interface 'ens33'
ens33 is a physical device
Handled network interface 'ens33'
Copying logfile /var/log/rear/rear-cap01.log into initramfs as '/tmp/rear-cap01-partial-2019-11-04T17:14:03+0530.log'
Copying files and directories
Copying binaries and libraries
Copying kernel modules
Copying all files in /lib*/firmware/
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (230799147 bytes) in 34 seconds
Making ISO image
Wrote ISO image: /var/lib/rear/output/rear-cap01.iso (229M)
Copying resulting files to nfs location
Saving /var/log/rear/rear-cap01.log as rear-cap01.log to nfs location
Creating tar archive '/tmp/rear.IcOaa604mQChxcF/outputfs/cap01/backup.tar.gz'
Archived 551 MiB [avg 4243 KiB/sec] OK
Archived 551 MiB in 134 seconds [avg 4212 KiB/sec]
Exiting rear mkbackup (PID 2148) and its descendant processes
Running exit tasks
You should also rm -Rf /tmp/rear.IcOaa604mQChxcF
[root@cap01 ~]#
 
10. Download the iso image for below location and keep it on your desktop for booting the system.
 
Location of ISO image stored on client system
[root@cap01 ~]# ls -l /var/lib/rear/output/rear-cap01.iso
-rw-------. 1 root root 238555136 Nov  4 20:13 /var/lib/rear/output/rear-cap01.iso
[root@cap01 ~]
 
Location of ISO Image stored in nfs servers. 
[root@cdn01 cap01]# ls -l /var/nfs-share/cap01/rear-cap01.iso
-rw-------. 1 root root 239697920 Nov  4 17:15 /var/nfs-share/cap01/rear-cap01.iso
[root@cdn01 cap01]#
 
 Performing a System Restore.
 
To perform a restore :
 
1. Boot the with ISO image 
2. In the console interface, select the "Recover" option:
3. You are taken to the prompt:
4. Run the rear recover command to perform the restore 
5. Ensure that SELinux relabels the files on the next boot:
     # touch /mnt/local/.autorelabel
Otherwise you may be unable to log in the system, because the /etc/passwd file may have the incorrect SELinux context.
6. Reboot the server. 




For more details refer to below link.
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-relax-and-recover_rear

1 comment:

  1. At the time of recovery nfs file system not mounting. Any suggestions

    ReplyDelete