Rsync Backup Server

From DD-WRT Wiki

Jump to: navigation, search

Contents

[edit] Introduction and Overview

rsync is a software application for Unix systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate. An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction. rsync can copy or display directory contents and copy files, optionally using compression and recursion.

In daemon mode, rsync listens to the default TCP port of 873, serving files in the native rsync protocol or via a remote shell such as RSH or SSH. In the latter case, the rsync client executable must be installed on both the local and the remote host.

Great for backing up networked computers to a central storage area. This article will explain how do setup a Rsync daemon on your dd-wrt router and have client computers in your Local network backup to them.

Compatible with Windows / Mac / Linux


[edit] Requirements

Good Howto on setting up a USB flash drive as the main /jffs/ [1]

[edit] Install Rsync on DD-Wrt

Make sure optware is setup right and that you have ushare available to you

/opt/bin/ipkg-opt update
/opt/bin/ipkg-opt list | grep rsync

returns: rsync - 3.0.4-2 - fast remote file copy program (like rcp)

/opt/bin/ipkg-opt install rsync


[edit] Basic Rsync Server Configuration

Create a path on your mass storage usb drive. You need to have it setup on a drive with lots of storage since it will be backing up your PC.

example: /mnt/drive1/rsync/pc1


vi /opt/etc/rsyncd.conf 

I am not sure if this is the most secure uid & gid but using uid = nobody & gid = nogroup gives me group errors. This works just fine

uid = root
gid = root
use chroot = yes
max connections = 5
syslog facility = local3
pid file = /var/run/rsyncd.pid
secrets file = /opt/etc/rsyncd.secrets

[pc1]
        path = /path/to/mass/storage/rsync/pc1
        comment = PC1 Rsync
        read only = no
        auth users = user1
 [pc2]
        path = /path/to/mass/storage/rsync/pc2
        comment = PC2 Rsync
        read only = no
        auth users = user2


Add as many rsync profiles as you need, just make sure you make a separate user for each one in the next step.


Set your share username & password

vi /opt/etc/rsyncd.secrets

Add a line for each user

user1:mypassword1
user2:mypassword2

Enable Rsync daemon

vi /opt/etc/default/rsync

Change RSYNC_ENABLE=false to RSYNC_ENABLE=true


Start Rsync Daemon

/opt/etc/init.d/S57rsyncd start

Check to see if its running

ps | grep rsync

Should return

30081 root      1456 S    /opt/bin/rsync --daemon

[edit] Client Configuration - Windows

I found DeltaCopy to be pretty quick and painless as far as windows clients goes. Download DeltaCopy

Setup is pretty easy. Create a new profile and set the following.

Profile Name: whatever you want Server IP: 192.168.1.1 or whatever your ddwrt router ip address is Virtual Directory Name: pc1 or whatever you called your profile in rsync.conf " [pc1]"

Test Connection & Add Profile

Click on the profile name and click on the Authentication Tab

enter your username & password you entered in the /opt/etc/rsyncd.secrets section

[edit] Client Configuration - OSX

The Mac makes it easy, as rsync comes with all recent versions of OS X. Just use rsync as you would on a Linux system. For example, to back up the home directory for a user named John, to the profile defined as 'pc1':

rsync -az /Users/john user1@192.168.1.1:pc1

[edit] Client Configuration - Linux

sudo apt-get install rsync
rsync --verbose  --progress --stats --compress \
     --recursive --times --perms --links --delete --exclude "*~" \
     /your/dir/to/backup/* user1@192.168.1.1:pc1

you can set up a simple cron nightly to do this

[edit] Questions / Comments

email undertoe at chemlab dot com

[edit] External Links

Helpful articles and information about Mac OS, how to backup mac

Mac backup software