If you are working as a system administrator, then it is your responsibility to protect organizations important data using proper way. it does not matter your organization is small or large, data is always important for any enterprise.

In computing term backup means, to save your critical data on remote location safely. Personally I recommend you to make multiple copies of backup of your backup. Having multiple copies of your data backup you can restore it easily if you are victim of these conditions:
database corruption, hardware failures, Physical computer damage, Virus Infection, and natural disasters.

`

 

 

In this tutorial we will use rsnapshot, which is powerful tool based on file system snapshot terminology written in Perl language.
rsnapshot is capable to schedule our backup jobs hourly, daily, weekly and monthly bases. It is a simple automated backup solution which is based on rsync.

To install rsnapshot through yum we need to install and enable third-party repository called EPEL.

 

RHEL/CentOS 7 64 Bit

# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

 

# rpm -ivh epel-release-7-5.noarch.rpm

 

RHEL/CentOS 6 32 bit

# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

 

# rpm -ivh epel-release-6-8.noarch.rpm

 

RHEL/CentOS 6 64-Bit

# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

 

# rpm -ivh epel-release-6-8.noarch.rpm

 

After installation EPEL Repository use the following yum command to install rsnapshot.

# yum install rsnapshot

 

 How to configure SSH Password-less Login coming soon!

 

Configuring Rsnapshot

Now open rsnapshot.conf file with vi or nano editor.

# vi /etc/rsnapshot.conf

 

Next create a backup directory, where you want to store backup of your important data. In my case I will create my backup directory called “/data/backup/”. Search following line in /etc/rsnapshot.conf and add following parameter to set where you want to store all your important data as backup.

 

snapshot_root                                  /data/backup/

 

Also uncomment the “cmd_ssh” line to allow to take remote backups over SSH. To uncomment the line remove the “#” in-front of the following line so that rsnapshot can securely transfer your data to a backup server.

 

cmd_ssh                                              /usr/bin/ssh

 

Next step is that, you need to decide how many old backups you would like to keep.This will take backup every six hours on a day but you can set your own schedule as per your requirements such as hourly, daily, weekly and monthly basis.

 

#########################################

#           BACKUP INTERVALS            #

# Must be unique and in ascending order #

# i.e. hourly, daily, weekly, etc.      #

#########################################

 

interval        hourly  6

interval        daily   7

interval        weekly  4

interval        monthly 3

 

Backup Local Directories

 

If you want backup your directories locally to the same machine then follow the steps.  If you want take a backup from windows client then first you need to mount directory in Linux machine. We have already written a tutorial how to mount window based share folder in Linux.

backup                 /broexperts/                    localhost/

backup                 /etc/                                   localhost/

 

Backup Remote Directories

 

If you want to backup up remote server directories then you need to follow the easy steps. I am taking a backup of my remote server “/home” directory under “/data/backup” directory on rsnapshot server.

backup                 root@example.com:/home/                     /data/backup/

 

Verify Rsnapshot Configuration

# rsnapshot configtest

 

# rsnapshot -t hourly

Automating the Process

Now i will show you how to schedule our backup process. In Linux we use cron jobs in order to schedule task. By default, rsnapshot comes with cron file under “/etc/cron.d/rsnapshot“, if it’s doesn’t exists create one and add the following lines to it. If rules already exist then you need to remove the “#” from of the scheduling section to enable these values.

 

# This is a sample cron file for rsnapshot.
# The values used correspond to the examples in /etc/rsnapshot.conf.
# There you can also set the backup points and many other things.
#
# To activate this cron file you have to uncomment the lines below.
# Feel free to adapt it to your needs.

0 */4 * * * root /usr/bin/rsnapshot hourly
 
30 3 * * * root /usr/bin/rsnapshot daily
 
0 3 * * 1 root /usr/bin/rsnapshot weekly
 
30 2 1 * * root /usr/bin/rsnapshot monthly

 

 
 
 
 
 

Similar Posts