December 28th, 2003

Unison = Peace of Mind


I have a lot of files. I kept all my files since 90s, documents, emails, everything. These files are scattered across different desktops and notebooks as I move them from one to another over the years. It become confusing and difficult to keep track of all my files.

So while sorting out my desktops and notebooks last week, I accidently trashed my financial account. Scanning the other machines found a backup (*phew*) but that was 6 months outdated (*sigh*). So I decided I need a better system. The system must be able to synchronize my files across multiple platforms (I have Windows, Linux, FreeBSD, OSX) seamlessly and can be automated easily.I used Windows offline files before for a while. It is really useful but it makes my Windows XP slow and sluggish. The biggest problem is that it won’t work on anything else except Windows XP.

I used to store my Unix home system on a CVS as Joey wrote in Linux Journal. CVS is also useful because it allows me to keep track of different version of the files and ablility to rollback. More importantly, it runs across multiple platform so I attempt to do so for a while.

Unfortunately, CVS isn’t so friendly to creation of new files and deletion of files. It requires you to manually “cvs add” and “cvs rm”. I tried to write a perl script to detect new files and deleted files but after a while, I discovered it is not worth the effort.

That’s when I discovered Unison.

Unison is a file-synchronization tool for Unix and Windows. (It also works on OSX to some extent, but it does not yet deal with ‘resource forks’ correctly; more information on OSX usage can be found on the unison-users mailing list archives.) It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other.

It is exactly what I need. Now, I have all my files stored on a server and synchronized to all my different desktops and notebooks via Unison. Whenever I am done on a desktop, I type “unison” and it sync with the server. When I move to another desktop, I type “unison” again and it updates the local content and I continue working. It allows me to switch from desktop to notebook with ease.

I also stop worrying about outdated or out-of-sync backup. All my files are still scattered across different machines but synchronized with each another. Backup? Well, just dump it out from my backup server. The only problem is all my files is about 6Gb but that gives me an excuse to get a DVD-RW drive :-)

The next thing I am going to do is to automated so that my blog server data get unison’ed to my backup server.

Comments are closed.