1

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" "[email protected]:/cygdrive/c/Test-Folder2"

SET PATH=%CWOLDPATH%

4 Answers 4

1

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.

2
  • As I need to do offsite-backups in original folder/file hierarchy, not as image/ISO/tar/gz/7z files format, i think Bacula or similar software is not an option for me.
    – Jags FL
    Dec 28, 2011 at 18:23
  • 1
    All of the tools you listed capture hierarchy - this is what backup software does - to restore that hierarchy you need to restore the backup from your backup media (run a restore job in Bacula/ArcServe/NTBackup/other software, untar/unzip an archive, etc.)
    – voretaq7
    Dec 28, 2011 at 20:09
0

Take a look at rsnapshot which may do what you want and can support windows.

0

Does your target machine have to be Windows?

I've helped set up a somewhat similar system. We rsync data to a ZFS filesystem on a FreeBSD box, then snapshot the ZFS filesystem. This gives you the best of both worlds: rsync is smart about only transferring altered data, and the ZFS snapshots only consume as much space as the altered data. Removing unneeded snapshots is very easy.

Unfortunately, I'm not aware of mature ZFS implementations for operating systems other than Solaris and FreeBSD.

Possibly there exists some mechanism by which a windows machine could do similar snapshots. Certainly NTFS supports similar copy-on-write functionality with the volume shadow service, but I'm not enough of a windows guru to say whether such a system would be viable.

(Note that I'm not recommending ZFS snapshots as a backup mechanism in and of themselves, but they can be useful as part of a larger system like this. Likewise, the Windows/NTFS volume shadow service is used by backup software including bacula and BackupExec.)

EDIT : (In response to your comment) It sounds like what you really want to do is set up a DFS share between the two sites. This will mirror files in (more or less) real time in both directions. Some caution needs to be exercised if there is potential for users to have the same file open on both sides, but in general it works very well for this sort of thing. It's not really the same thing as a backup, but it seems that what you want is a live file system on both sides. Not sure about DFS and accidental deletions, although other NTFS features may cover you there.

2
  • Many thanks for the reply. Yes target machine is also a Windows Server 2008 R2. And as I've mentioned, I would like to backup a folder from Server#1 to Server#2 and vice versa. Both machines are 2008 R2 and both stores data on RAID-6 volume locally, the reasons for offsite backups(and to keep two full backups) are to safeguard data from fire/accidental deletion(has happened in past) etc. Both servers are located in different physical locations. Hard drive space and bandwidth are not issues.
    – Jags FL
    Dec 28, 2011 at 19:45
  • @JagsFL See my edit. Depending on risk tolerance, you may still want periodic tape backups.
    – eaj
    Dec 28, 2011 at 23:38
0

The backup tool dirvish uses rsync as a backend to create rotating backups similar to Time Machine (without the awesome interface).

2
  • It sounds like "drivish" is not for Windows.
    – Jags FL
    Dec 28, 2011 at 18:33
  • Not specifically, but should work with a Cygwin layer.
    – Tim
    Dec 28, 2011 at 18:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .