This is very simple to use, I wished to write it anyway because before I do OS/application/security patches and much more I wanted to ensure that I would keep the complete backup of server in worst case as this be being production critical.
we would first need to install rear package which can be downloaded from the epel repository. Before I proceed I would provide you environment.
Environment : Oracle Linux 6 with Redhat kernel(2.6.32-573.el6.x86_64)
rear verion : rear-1.18-3.el6.x86_64
DR copy : NFS storage(nfsserver.testlabs.com)
You would have your rear package in EPEL repository and can be downloaded from their mirror, else just copy & paste below
hostname#cat > /etc/yum.repos.d/epel.repo
name=Extra Packages for Enterprise Linux 6 - $basearch
hostname# yum install rear
Note: Make sure you are already installed with 'genisoimage' and 'syslinux' without which rear wont be able to install.
hostname#rpm -ivh wget ftp://ftp.muug.mb.ca/mirror/centos/6.7/os/x86_64/Packages/genisoimage-1.1.9-12.el6.x86_64.rpm
hostname#yum install genisoimage
Let rear know as to which location it needs to be backuped ? It could be defined below :
Resulting ISO image would be used for DR recovery purpose which takes backup from the NFS in order to restore files/dirs.
hostname# rear -v mkbackup
Relax-and-Recover 1.18 / Git
Using log file: /var/log/rear/rear-hostname.log
Creating disk layout
Creating root filesystem layout
TIP: To login as root via ssh you need to set up /root/.ssh/authorized_keys or SSH_ROOT_PASSWORD in your configuration file
Copying files and directories
Copying binaries and libraries
Copying kernel modules
Making ISO image
Wrote ISO image: /var/lib/rear/output/rear-hostname.iso (74M)
Copying resulting files to nfs location
Creating tar archive '/tmp/rear.NZP1vXar0Vmq5nr/outputfs/hostname/backup.tar.gz'
Archived 14 MiB [avg 3584 KiB/sec]
Archived 5644 MiB [avg 8268 KiB/sec]OK
Archived 5644 MiB in 700 seconds [avg 8256 KiB/sec]
You would have all your system files backuped to NFS server, you can just confirm by logging to storage box.
nsfserver# /dr/hostname# ls
./ README backup.log rear-hostname.iso
../ VERSION backup.tar.gz rear.log
When your server unable to boot or any libraries corruption etc etc for any reasons you can copy the iso image from NFS path and boot from CDROM and recover.
I tested and I would share to all readers.
I will corrupt the server, remove binaries, remove bootable files etc etc and will restore from ISO image from the NFS location.
hostname# rm -rf /boot/*
hostname# ls -l /boot
hostname# rm -rf /bin/*
-bash: /bin/ls: No such file or directory
when you boot from ISO image you need to choose Recover hostname from the below options
After booting, it would go to RESCUE shell, check you are able to reach to your NFS server in order to restore the files.
RESCUE: rear recover
This would start copying all your data from the NFS to the client server. It might take minutes/hours depending on the data. Once its been completed just boot up your client machine it would be operational.
hostname: # ls -l /boot/ | wc -l
Now you have restored you system with backup.
There can't be excuse incase if you are not using this tool. its very easy, simple and would request readers to take 1 copy of ISO image would save lot of time and efforts in worst cases. Plan for the best, but prepare for the worst.
Thanks for all who read this post.