WikiDevi.Wi-Cat.RU:DD-WRT/Rsync Backup Server

From WikiDevi.Wi-Cat.RU
Jump to navigation Jump to search
Source

Source

Rsync Backup Server @ dd-wrt

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


Requirements

  • Telnet / SSH
  • Optware Package System Setup
  • Startup Script for Installed Optware Packages
  • USB Support or External Storage support (For Backup Storage)
  • Rsyncd Service
  • Rsync Client Software (Windows/Mac/Linux)

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

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


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

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

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

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

Questions / Comments

email undertoe at chemlab dot com

External Links

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

Mac backup software