Quantcast
Channel: Tech Support
Viewing all articles
Browse latest Browse all 880

Disaster Recovery Solution for Linux Servers - Step by Step

$
0
0

Relax-and-Recover is an easy to setup and maintenance free migration & disaster recovery solution compatible with CentOS, RHEL, OEL and many other known linux distributions. It has capability to detect hardware changes and preserves the last condition of the operating system including its partitions, boot loader configuration, all the system data etc if you are restoring linux servers backup images to dissimilar hardware.

This step by step guide will show you how to use Relax-and-Recover and create a bootable USB backup for your critical linux environment. For this tutorial, we are using CentOS 7 but you are free to use linux distribution of your choice.

 

Creating NFS Shares 

First, you need to create an NFS Share to store all of your linux servers backup images. To install NFS utilities on your linux machine you have as a backup server. Run the following command to install it with root privileges.

yum install nfs-utils -y

When you are done installing nfs with above command, create nfs share directory and make it accessible from all of your linux servers you are going to take backup using the following commands.

mkdir /Backup 

vi /etc/exports
/Backup    *(fsid=0,rw,sync,no_root_squash,no_subtree_check,crossmnt)

Save and close 

Now restart nfs service to take changes effect using the following command.

systemctl restart nfs

 

Installing Relax-and-Recover

To install relax-and-recover package and required dependencies, run the following command with root privileges.

yum install rear syslinux genisoimage -y

Once installation completed. Open the relax-and-recover configuration file /etc/rear/local.conf and define backup store location of nfs we have created earlier.

vi /etc/rear/local.conf

OUTPUT=ISO
BACKUP=NETFS
BACKUP_URL=nfs://your-nfs-server-ip/Backup

Save and close

 

Creating Backup

To take the backup image of your linux server, run the following command with root privileges.

rear -d -v mkbackup

This will begin creating an ISO image of your linux server and store it locally under the directory /var/lib/rear/output and then it will automatically move all the files along with backup ISO image to NFS share.

 

Testing Recovery with backup image

Let's test recovery method with newly created backup image of our linux server. For that, we need to burn the following ISO file on CD or DVD.



Booting server with the same bootable CD present the following relax-and-recover menu screen.


Select the first option from the boot menu Recover localhost and press enter. After this, we will now have our login menu, login using root without password.


Now we need to configure network settings on our system to access remote NFS Share. To add an IP address, execute the following command.

ip addr add 192.168.0.11/24 dev enp0s3
ip link set enp0s3 up

To start the recovery, run following command

rear -d -v recover


Type 1 and press enter to select /dev/sda as your disk.

Now it will ask for disk layout, type 5 and press enter to continue


It will start recovery procedure


It will take server minutes to complete the recovery. Once its done, reboot the system.


You are done. Now eject the recovery CD/DVD from the system.

 

Creating Bootable USB Backup 

If you want to make usb bootable with backup images of your linux servers instead of nfs share then use the following steps.

Prepare your USB media. Change /dev/sdb to the correct device in your situation. Relax-and-Recover will ‘own’ the device in this example.

This will destroy all data on that device.
/usr/sbin/rear format /dev/sdb

It will ask you to confirm that you want to format the usb device: type Yes and press enter
The usb device will be labeled REAR-000 by the ‘format’ workflow.

Now edit the ‘etc/rear/local.conf’ configuration file:

cat > etc/rear/local.conf <### write the rescue initramfs to USB and update the USB bootloader
OUTPUT=USB

### create a backup using the internal NETFS method, using 'tar'
BACKUP=NETFS

### write both rescue image and backup to the device labeled REAR-000
BACKUP_URL=usb:///dev/disk/by-label/REAR-000
EOF


Now you are ready to create a rescue image. We want verbose output.

/usr/sbin/rear -v mkrescue

Output:
Relax-and-Recover 1.13.0 / $Date$
Using log file: /home/jeroen/tmp/quickstart/rear/var/log/rear/rear-fireflash.log
Creating disk layout
Creating root filesystem layout
WARNING: To login as root via ssh you need to setup an authorized_keys file in /root/.ssh
Copying files and directories
Copying binaries and libraries
Copying kernel modules
Creating initramfs
Writing MBR to /dev/sdb
Copying resulting files to usb location


You might want to check the log file for possible errors or see what Relax-and-Recover is doing. 

Now reboot your system and try to boot from the USB device.

If that worked, you can dive into the advanced Relax-and-Recover options and start creating full backups. If your USB device has enough space, initiate a backup using:
/usr/sbin/rear -v mkbackup

That is it.

Viewing all articles
Browse latest Browse all 880

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>