Back up Windows server with cwRsync and rsnapshot

Here is how to backup data from Windows servers to a Linux backup server using  rsync.  Specifically using cwRsync server (a Cygwin + rsync package) running on the Windows server, and rsnapshot running on the Linux backup server.  This was tested with rsync 3.0.7 and rsnapshot 1.3.1 on Linux (CentOS 5.4), and cwRsync 4.0.4 (includes rsync 3.0.7) on Windows (Server 2008).


First download the cwRsync server package and install it on the Windows server.  It will attempt to create a service user for cwRsync, but the user creation did not work for me.  Rather specify the name and password of an existing service account (specially-created if necessary) for RsyncServer service to run as.  Use the services panel to configure RsyncServer to run automatically on boot.  Before starting the service, configure the rsyncd.conf along these lines:
uid = 0
gid = 0
use chroot = false
strict modes = false
hosts allow = backups.example.com
log file = rsyncd.log
[examplemodule]
path = /cygdrive/c/example/path/to/back/up
read only = true
transfer logging = yes
The uid=0 and gid=0 must be added to avoid the @ERROR Invalid UID nobody. The hosts allow line is to only allow the backup server to access the data.  Configure rsync modules for each local resource to back up, using Cygwin paths (/cygdrive/c).  You can test the rsyncd.conf by running rsync from the cwRsync "ICW" directory in Program Files and attempting to rsync from it on the Linux server:
bin\rsync.exe --config=rsyncd.conf --daemon --no-detach
On the Linux backup server, install rsnapshot, and see the Debian rsnapshot article for an example of /etc/cron.d/rsnapshot to perform the hourly, daily, weekly backups.  By default there are 6 hourly snapshots (one every 4 hours), 7 daily snapshots, 4 weekly snapshots and 3 monthly snapshots.   For example, /etc/rsnapshot.conf would need a line like this to get data from the windows server.  Type tabs between the items, not spaces:
backup    rsync://windowsbox.example.com/examplemodule     windowsbox
 
Also config the snapshot_root to where you want the files to go. The awesomeness of rsnapshot is that it uses the rsync --link-dest option: as it creates the new snapshot it detects unchanged files from the previous snapshot and hardlinks back to them.  Thus, you get complete snapshots using only an incremental amount of space.   To view the files as they were 3 days ago, visit the daily.3 directory under "windowsbox" in snapshot_root.

Popular posts from this blog

Cutting down on clutter with the Outbox Method

A comparison of file synchronisation software