In the past few weeks I have been using a new free software tool called "Unison (file synchronizer)" - also see "Unison manual". I solved two problems with it:
@echo =============== Starting two-way synch ===============
setlocal
set IDEAPAD_HOST=40.40.40.3
set UNISON_PATH=c:\unison
set UNISON_EXE=%UNISON_PATH%\unison.exe
set UNISON_CFG=%UNISON_PATH%\synch.prf
xcopy %UNISON_CFG% c:\users\Roman\.unison\default.prf /f /y
set SOURCE=c:\
set BACKUP_DEST=ssh://%IDEAPAD_HOST%/c:/
set RUN=%UNISON_EXE% %SOURCE% %BACKUP_DEST%
%RUN% -path My_Documents -path My_Projects -path My_Photos
endlocal
Here is an example of the script I am using for backup (one way synch):
@echo =============== Starting backup ===============
setlocal
set BACKUP_DEST=x:\backup
set UNISON_PATH=c:\unison
set UNISON_EXE=%UNISON_PATH%\unison.exe
set UNISON_CFG=%UNISON_PATH%\backup.prf
xcopy %UNISON_CFG% c:\users\Roman\.unison\default.prf /f /y
set SOURCE=c:\
set RUN=%UNISON_EXE% %SOURCE% %BACKUP_DEST% -nocreation %SOURCE% -noupdate %SOURCE% -force %SOURCE%
%RUN% -path My_Documents
%RUN% -path My_Photos
%RUN% -path My_Projects
%RUN% -path My_Videos
endlocal
PS. Directory names, IP addresses and host names are renamed to protect the innocent.
- First problem
was that I have small travel laptop (Lenovo IdeaPad 460U) and more powerful laptop that is way too heavy to take on the road (Lenovo ThinkPad W700 - a true monster). 90% of the time I work on the ThinkPad and all my document files, projects, source code, photos, music, etc. are located on the local file system. However when I travel I need to have all of it with me and in the past I had to make a fresh copy of all that stuff - manually. When I updated files on the second laptop during my trip, I would need to copy it back to the main machine and not forget what to copy. The Unison utility makes it very easy to keep as many different file systems in complete synchrony. Those files and directories can be local and accessible on the same machine or remote, in which case Unison uses "ssh" to make remote copy. Unison is very smart so it only copies updated files and even better - it uses rsynch, so it only moves deltas of the files, not complete files. Unison can synch files between Windows, Linux, etc. Since both of my machines are Windows, I use another free package called Cygwin (on both computers) for SSH (secure shell) function and that was very easy to setup - just follow Unison manual. - Second problem
was the backup of my files. I used to simply do xcopy and did not trust all the fancy GUI tools for backup as they have a number of shortcomings (too many to list here). With Unison, I configured it to only synch files in one direction (basically turned Unison into rsynch for backup purpose. Even for huge directories with many thousands of files the backup completes in a matter of seconds or minutes (depending how much content has changed). Now I always have a complete backup of my stuff and no need to worry about the incremental backups and unrolling from the incremental backup one by one. Just a snapshot of my files at any given time. I do this manually, but you could put it on cron schedule.
Here is an example of the script I use to synch two computers (two way synch):
setlocal
set IDEAPAD_HOST=40.40.40.3
set UNISON_PATH=c:\unison
set UNISON_EXE=%UNISON_PATH%\unison.exe
set UNISON_CFG=%UNISON_PATH%\synch.prf
xcopy %UNISON_CFG% c:\users\Roman\.unison\default.prf /f /y
set SOURCE=c:\
set BACKUP_DEST=ssh://%IDEAPAD_HOST%/c:/
set RUN=%UNISON_EXE% %SOURCE% %BACKUP_DEST%
%RUN% -path My_Documents -path My_Projects -path My_Photos
endlocal
@echo =============== Starting backup ===============
setlocal
set BACKUP_DEST=x:\backup
set UNISON_PATH=c:\unison
set UNISON_EXE=%UNISON_PATH%\unison.exe
set UNISON_CFG=%UNISON_PATH%\backup.prf
xcopy %UNISON_CFG% c:\users\Roman\.unison\default.prf /f /y
set SOURCE=c:\
set RUN=%UNISON_EXE% %SOURCE% %BACKUP_DEST% -nocreation %SOURCE% -noupdate %SOURCE% -force %SOURCE%
%RUN% -path My_Documents
%RUN% -path My_Photos
%RUN% -path My_Projects
%RUN% -path My_Videos
endlocal
PS. Directory names, IP addresses and host names are renamed to protect the innocent.
No comments:
Post a Comment