Rsync command for offsite rolling backups

backuprsyncwindows-server-2008-r2

I've read a lot of articles and tried to come up my self but couldn't, so need help with Rsync command for offsite rolling backups please.

I have installed cwRsync(in VMs as a test run for now) on two Windows Servers(both 2008 R2) and would like to setup rolling backups of a folder(which contains many folders within) from server# 1 to #2 and vice-versa.

I would like to push full backups twice a week(8:00PM Monday & Thursday) and like to delete first backup when third is completed, and so on. (attached schedule as a PNG)

So far I've transferred folder/files by running following in a .cmd file; any help is greatly appreciated.

REM Set HOMEPATH values
SET HOMEDRIVE=%CD:~0,2%
SET HOMEPATH=%CD:~3%
SET CWRSYNCHOME=%CD%
SET CWOLDPATH=%PATH%
SET PATH=%CWRSYNCHOME%\BIN;%PATH%
SET HOME=%HOMEDRIVE%\%HOMEPATH%

rsync -avrz -ssh "/cygdrive/C/Test-Folder1" "RSBService@192.168.1.190:/cygdrive/c/Test-Folder2"

SET PATH=%CWOLDPATH%

Best Answer

rsync is a Remote SYNChronization tool -- It makes the data on the target machine look like the data on the source machine, and tries to be smart and efficient about it.
It can give you a great backup of the last state of the source machine, but it doesn't do "rolling backups" like you're describing, and can't without a lot of external scripting (or a lot of wasted transfer).

In order to do what you want you would need to:

  • rsync nightly
  • On Monday and Thursday make a complete copy of the directory on the target machine to a "full backups" directory
  • On all other days collect the list of the files that changed (from your rsync output) and copy them to an "incremental backups" directory.
  • Replace/Overwrite the Full and Incremental directories as needed.

You are probably better off using a true backup system solution like Bacula to back up to "virtual tapes" on disk, and then rsyncing the virtual tape files to your off-site storage.

Related Topic