Linux OS backup and Restoration using ReaR – Relax & Recover

ReaR – Relax and Recover is an Opensource tool for backing up your OS.
The Physical to Virtual and Virtual to Physical migration of OS is also possible with ReaR
You can also integrate your favorite backup tools like IBM TSM or HP Data Protector with ReaR to backup the OS to External Storage

Here is the setup I used

OS :openSuSE 11.4
ReaR package: rear-1.10.0-23.1.noarch
Pre-requisites 1:
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadIsLzma) <= 4.4.6-1

Pre-requisite 2:
                NFS server ( I used RHEL5 )with a share /rear/backup and the share must have write permission
                /rear/backup     *(rw,no_root_squash)
                service nfs start
                showmount –e
                If yor NFS server is already running, then
                Add “/rear/backup          *(rw,no_root_squash)” to /etc/exports
                exportfs –a
                showmount –e

The main configuration file is /etc/rear/local.conf
Make sure below entries are present on file

Then execute rear to create a backup with bootable ISO which can be used for booting incase of system crash and using that file we can restore OS from NFS partition

You can also configure a PXE boot server to recover the OS without making ISO to DVD for booting

mysql01:~ # rear mkbackup
Relax & Recover Version 1.10.0 / 2011-02-20

WARNING ! The NETFS backup method should not be your primary
backup solution, because it does not fulfill the requirements
of a professional backup solution !

The preparation phase  OK
Physical devices that will be recovered: /dev/sda
Creating root FS layout  OK
WARNING: To login as root via ssh you need to setup an authorized_keys file in /root/.ssh
Copy files and directories  OK
Copy program files & libraries  OK
Copy kernel modules  OK
Checking udev  OK
Create initramfs  \

It will take some time to backup all partitions ,depends on the data inside every partition

After completion of backup ,the files will be stored in NFS share.
The files will be inside a directory with the name same as host name.In my case the host name is mysql01
So I got a directory named mysql01 in /rear/backup

The contents inside the directory is listed below

total 1430088
-rw-r--r-- 1 root root 1418761646 Mar 18 14:11 backup.tar.gz
-rw-r--r-- 1 root root    8329424 Mar 18 16:59 backup.txt
-rw-r--r-- 1 root root        202 Mar 18 14:11 README
-rw-r--r-- 1 root root      35321 Mar 18 14:11 rear-2012-03-18T14:11:38+0530.log
-rw-r--r-- 1 root root   35821568 Mar 18 14:11 rear-mysql01.iso
-rw-r--r-- 1 root root        368 Mar 18 14:11 VERSION

The rear-mysql01.iso need to written to a CD or DVD to boot the system after a crash

Suppose my server mysql01 is crashed because of File system corruption ,then we will follow the below steps

1.Write the rear-mysql01.iso to a DVD/CD
2.Boot from the CD/DVD which is now created
3.on boot: prompt enter rear and press Enter
                boot:rear àpress enter
4.Login with user name root (It will not ask for password)
5.We will get a prompt
6.Set up network using IP command
                                # ip addr add dev eth0
                                # ip link set eth0 up
                                If you need to add a route ,use “ip route” command (man ip for more details)
7.Now check whether the NFS server is reachable using PING
8.If the server is accessible then execure rear recover
                                # rear recover
                                The command will mount the NFS share and it will create all partitions as previous and restores all data  
9.Once the restoration completed ,remove the DVD/CD and reboot
10.You will get your system in perfect condition
If you are going to restore the OS backup of one server to another,
1. Boot from DVD/CD
2. Login as root (Will not ask for password)
3.Set up networking
4.rear recover
3.Mount /dev/system/root /mnt /mnt/etc/fstab and check the disk ids and change it to present disks id (you can use VI to edit file)
                /dev/disk/by-id/ata-XXXXX ace79de-c82e0d0d-part1     /boot    ext4 acl,user_xattr  1 2
5.chroot /mnt
    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]

grub> root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/e2fs_stage1_5" exists... yes
 Running "embed /grub/e2fs_stage1_5 (hd0)"...  15 sectors are embedded.
 Running "install /grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/grub/stage2 /grub/grub
.conf"... succeeded
7.Remove the DVD/CD and reboot it
8.You got the OS clone in different server

Happy backup Day ... ;)


  1. It really helpfull & I hope for next

  2. very good topic and useful ...thanks

  3. It was very helpful.

  4. ISO image is not getting created. Please tell me how to proceed on this.

    1. make sure you have OUTPUT=ISO set in you config file
      It might be set as PXE

  5. Hi, I have one question...

    I have taken backup with ISO format in NFS server and need to install on VMWARE guest. Is it possible to mount from NFS for booting instead of writing in DVD for booting?

    1. Yes,you can use ISO for any console supports virtual DVD drive (VMware , HPE ILO or any server console that allow you to attach ISO image as a media )

  6. I am trying to make backup of rhel 6.x,
    i am storing the iso in usb drive by the procedure mentioned in quick reference guide or rear.
    But once is restore it, the system crashes, it hangs on grub prompt, any how it passes grub, then it hangs with kernal panic error.

  7. I cloned physical machine to VMWare host successfully, but observed one thing, I had to select disk size on vmware same as on physical machine.

    1. You can use customise volume layout during back itself - I'll post the procedure in coming days


Post a Comment

Popular posts from this blog

How to Configure Squid with Mysql DB authentication

How to Configure YUM in RHEL6