Efficient backup from windows to linux via rsync

written by Admin


Posted on 2013-08-06


Problem

I want to backup efficiently (incremental backup) a windows box via rsync on a linux box.

Solution

First install Cygwin on the windows box (don't forget to check rsync and ssh during installation) and check if rsync is installed on the linux box; if not, install it using APT (or the package manager of your distribution) and create a repository: add in /etc/rsyncd.cont a block like this (don't forget to adapt some parameters to reflect your configuration):
[repository_name]
   path = /home/backup/repository_name
   uid = nobody
   gid = nogroup
   read only = no
   use chroot = yes
   list = yes
   auth users = username
   secrets file = /etc/rsyncd.secrets

Then - again on the linux machine - add username and password in the file /etc/rsyncd.secrets using this format:
username:password
username2:password2
username3:password3
[..]
usernameN:passwordN

On the windows box create a text file and put into that file only the password of the rsync repository in the linux box.

Put this line in a .bat file and schedule the nightly execution (control panel - scheduled tasks):
C:\path\of\rsync -a -v --delete --password-file=C:\path\to\password.txt /cygdrive/c/source_dir rsync://username@ip_address/repository_name

On some system you need to put the rsync (cygwin) directory in the PATH environment variabile (My Computer - Properties - Advanced - Environment Variables).

Feedback


Leave a Comment:


Search

Categories

android x 1
apache x 1
apple x 4
backup x 2
cygwin x 1
dns x 1
dos x 1
drupal x 3
ftp x 1
iis x 1
imap x 1
linux x 22
mail x 4
mysql x 3
oracle x 1
pop3 x 1
print x 2
proxy x 1
rsync x 1
shell x 8
smtp x 1
squid x 1
ssh x 1
storage x 2
web x 3
windows x 15

Welcome

We need collaboration and a real boost from our community: write us an email for every trick you find!

This website is a sysadmin swiss-knife for every-day Windows, Linux and Mac administration and troubleshooting

Our database grows if YOU send us your tips and trick as soon as you find them every day!