1 August 2005

Backing up and Syncing Files

by Anton Piatek

I keep all my documents in a folder together, and back them up occasionally using rsync to a remote server. I do the same with my digital photos, so that if my hard drive ever crashes (won’t be the first time) then I won’t lose all my data and photos.

 This works fine with one machine and a remote server. But what if you have two machines you work from, eg a laptop and desktop or home and work/uni. Rsync cannot tell if a file has been deleted or is new, so you cannot use it to sync files across two machines where files could change on either.

Unison solves this problem. Available free under the GPL for both linux and windows in both command line and gui versions.

With unison on both machines, it tracks which files are in your directories, so when you delete one, it knows that it should probably be deleted from the other one. It seems to handle conflicts quite well (prompting the user to make the decision).

 So now I have my documents across 2 machines, and backed up to a server. I do not have to worry about copying them anywhere, so long as i run Unison occasionally. Any new document I write can easily be copied to my other computer by simply updating on each computer. I can even add this to a script that runs every week or every day, and then the files will only be out by a day if I do nothing more!