How to perform automatic backup on ClearOS 6.4

This tutorial is going to show you how to backup data automatically on ClearOS server. On this tutorial I am using rsnapshot as the backup solution for Linux. rsnapshot is pretty easy to configure and it supports almost any Linux distribution including ClearOS. We can automate the ClearOS to backup the data on daily, weekly or monthly basis. Set once and forget the backup. rsnapshot will do it for you.

This tutorial will show you how to backup a specific directory to an external hard drive. I want to backup my /home directory to my external drive (/dev/sdb1) which is mounted on /media/backup/.

 

Step 1. Install rsnapshot on ClearOS 6.4

Use this command to start installing rsnapshot (as root)

yum install rsnapshot

Step 2. Edit rsnapshot config file

nano /etc/rsnapshot.conf

Here is the default rsnapshot config file. I just take the important parts we need to configure

 

#######################
# CONFIG FILE VERSION #
#######################

config_version  1.2

###########################
# SNAPSHOT ROOT DIRECTORY #
###########################

# All snapshots will be stored under this root directory.
#
snapshot_root   /.snapshots/

# If no_create_root is enabled, rsnapshot will not automatically create the
# snapshot_root directory. This is particularly useful if you are backing
# up to removable media, such as a FireWire or USB drive.
#
#no_create_root 1

#########################################
#           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 POINTS / SCRIPTS ###
###############################

# LOCALHOST
backup  /home/          localhost/
backup  /etc/           localhost/
backup  /usr/local/     localhost/

#backup /var/log/rsnapshot              localhost/
#backup /etc/passwd     localhost/
#backup /home/foo/My Documents/         localhost/
#backup /foo/bar/       localhost/      one_fs=1, rsync_short_args=-urltvpog
#backup_script  /usr/local/bin/backup_pgsql.sh  localhost/postgres/

Above is the default value. To match my needs, I change the value above into these ones:

snapshot_root   /media/backup/

I just want to backup in daily base, so I remove or add # symbol next to the other time frames.

#interval        hourly  6
interval        daily   7
#interval        weekly  4
And I want to backup my home directory only :

backup  /home/          localhost/

Now save and exit. Next is to test the configuration. Use this command below and if you see output “Syntax OK” then you are ready to go

rsnapshot configtest

Output should be something like this

[root@gateway ~]# rsnapshot configtest
Syntax OK


Rsnapshot command needs to be excuted in order to run automatically. Now, we need to add the rsnapshot command to crontab. Since I am bit confuse with contab command/syntax, I use webmin to configure the automatic execution of this rsnapshot. Please follow this instruction to install webmin on ClearOS.

3. Add new cron job

To add CronJob for rsnapshot, open webmin via your browser, https://192.168.1.2:10000 (change the IP address with yours)

cronjob-clearos

Go to System | Scheduled Cron Job. Then click Create a new scheduled cron job.

cronjob-clearos-1

Enter the following details:

execute cron job as : root

Command: /usr/bin/rsnapshot daily

schedule: you can choose as you want.

Click create to create the new cron job. At this point, backup will be executed based on your schedule.

3 comments

hello,

when I tried to install rsnapshot as root it displays "No package rsnapshot available". kindly advise.

Regards
Nishant

@anonymous, try this link
http://www.tecmint.com/rsnapshot-a-file-system-backup-utility-for-linux/

upss..sorry.
I mean @nishant, try this link
http://www.tecmint.com/rsnapshot-a-file-system-backup-utility-for-linux/


Regards
Kartolo