Thursday, May 30, 2013

How to perform automatic backup on ClearOS 6.4 using Rsync

Rsync is a powerful tool to perform backup from one computer/server to another. on this tutorial I am going to show you how to use rsync to perform automatic backup on ClearOS 6.4 server. The idea here is to backup a directory from ClearOS 6.4 server to another location or another server.

Requirements:

  • rsync package installed on ClearOS server
  • Another computer to store the backup. I am using a Samba shared folder on another computer on the same LAN.

 

First we need to make sure if rsync is installed on ClearOS 6.4. Type this command to check

rsync --version

It should returned similar to this

rsync  version 3.0.6  protocol version 30
Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.
Web site:
http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, xattrs, iconv, symtimes

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

If not, you may need to install rsync

yum install rsync

On this example I want to backup the directory inside /var/flexshare/shares into "backup" shared directory on other computer with IP address 192.168.1.10.

To backup using rsync, simply execute this command

rsync -avv /var/flexshare/shares/mapping_database -e ssh admin@192.168.1.10:/backup

If you want to delete the files and directory on the remote computer that do not exist on the source, you can add --delete options into the command

rsync --delete -avv /var/flexshare/shares/mapping_database -e ssh admin@192.168.1.10:/backup

To automate this job, you can create a new cron job. I do this via webmin. Please read how to install webmin on ClearOS 6.4 just in case you need it.

0 comments:

Based on original Visionary template by Justin Tadlock
Visionary Reloaded theme by Blogger Templates
This template is brought to you by Blogger templates

Visionary WordPress Theme by Justin Tadlock Powered by Blogger, state-of-the-art semantic personal publishing platform