The Cygwin Project made a beautiful version of rsync, i do recommended you take a look to see how much of the *nix world you can bring to your Windows computer!http://cygwin.org/
This specifically talk about using their implementation of rsync. as gathered by BackUP PC
their directions help you set up rsync as a service for a central machine to reach out and make a backup. you can set it to read only have it always run ect ect ect. this is great if you have a file server someplace. or simply want to make 2 machines nearly identical. This should be set for a time when your not logged in but the Machine is on.
However I expand on this with a more graceful and personal variation. Rsync can be used locally between 2 local filesystems (USB HDD anyone!) and a log-off script. basically when you shut down, or log off this thing fires off and makes the 2 locations the same. This gives you a backup of your needed data that can be referred to when needed.
so once installed you can do a command similar to
C:\opt\rsyncd\rsync.exe -uav "/cygdrive/c/docume~1/username" "/cygdrive/e/filesync/backup" >>cygdrive/e/rsync.log
This will backup your entire user profile in its entirety
How i used this. I created a folder called c:\opt and installed the binary in a folder there. I then created a folder on my destination drive to backup to (in this case an external Drive)
Here is where it gets interesting, create a back file with the desired rsync commands. save this, ( i used the handy c:\opt) then you can create a task, that every time you log off your computer it executes a batch file. this way you are not really logged in, so files normally being accessed (like outlook pst's and ost's) are not in use then it does a backup of files that have been changed (new version) every time you log off/shutdown/reboot. and the way rsync works it moves quite quickly.
This is the batch file i have run each time i log off the computer
It cleans up Google chrome and IE cache only. tidies up the log file and then runs my rsync.
@echo off
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
del C:\Documents and Settings\username\Local Settings\Application Data\Google\Chrome\User Data\Default\Cache\*.*
del e:\filesync\rsync.old.log
copy e:\filesync\rsync.log e:\filesync\rsync.old.log
del e:\filesync\rsync.log
C:\opt\rsyncd\rsync.exe -uacv "/cygdrive/c/Documents and Settings/username" "/cygdrive/e/filesync/backup" > e:\filesync\rsync.log
E is the drive letter of the externally attached HDD i have.
Other things to try:
- -b (i.e. -avb) makes backup copies of any files at the destination, before updating.
- -u (i.e. -avu) updates - won't overwrite newer files.
- -S (i.e. -avS) is more efficient if you have sparse files.
- rsync -e ssh -av --delete "/cygdrive/d/" remote:/rsync/data1/d >>rsync.log will log the transfers to file rsync.log
- -z (i.e. -avz) is very useful if doing it by modem. This compresses the information before transport. Waste of time if on a fast network.
- -P (i.e. -avP) shows progress during transfers, and also keeps partially transferred files so that if the transfer is interrupted mid-file, the bit already transferred isn't wasted. Again, good if rsyncing by modem.
- The --exclude option is very useful to exclude swap files. You may also want to exclude things like netscape caches. For example:
--exclude 'pagefile.sys' --exclude 'WIN386.SWP' --exclude 'Cache/' - --backup-dir=PATH puts all old versions of files into the named directory, thus giving an incremental backup.
- Look at the rsync man page for more ideas.
I forgot to add how to add as a log-off script.
ReplyDeleteOpen the Windows Start menu and select Run. Enter gpedit.msc and click OK. The Group Policy Object Editor opens.
In the left pane, expand User Configuration / Windows Settings and select Scripts (Logon/Logoff).
In the right pane, double-click Logoff to open Properties.
Hit browse, then browse to the batch file you want to run every time you log off the computer.
There is an update. The older version of rsync does not work with windows 7, you need to make sure you have rsync 3.x This is most readily done by installing cygwin and installing the updated version. you can then call it directly like so "C:\cygwin\bin\rsync.exe"
ReplyDelete