Like many people, I have the problem that I have way too many home directories - one on my laptop, one on my main desktop etc. For the longest time, I tried to keep them in sync with crazy schemes involving rsync or NFS mounting and the like. And it never quite worked; with rsync, it’s too easy to clobber changes, since you always modify files in both places, no matter how hard you try not to. With NFS you really need to export your home directory from the laptop (otherwise you’re back to rsyncing every time you go on a trip) — and that just breaks beautifully when pull your laptop out of your home network and your other machines fall over themselves because they can’t access your home directory any more.
While these mirroring solutions work just well enough that you try and live with their shortcomings, I finally got so annoyed that I started to look for something else and came across Unison As the project page points out, what I have isn’t a mirroring problem, where one side is the master and the other a mere copy, I have a synchronization problem, one where both copies can be changed independently. And a file synchronizer like Unison will spot modifications on both sides and do its best to reconcile them automatically, or failing that, it will ask the user what to do. But it will never, ever clobber changes.
With Unison, life is good; I now have separate home directories on my laptop and my desktop, and keep them in sync by running Unison periodically, and so far, it hasn’t let me down. Given its provenance, there is of course a nice amount of theory behind it — though you don’t need to know about it to use Unison.
Another aspect that quite literally blew me away is that Unison is very fast (I can’t really tell a difference between Unison and running rsync on my quite rotund home directory). Even more surprisingly, it’s not written in C, but in OCaml; that nicely supports the claim that I’ve heard a few times now that OCaml is both fast and suitable for writing code that’s pretty close to the system.
Watzmann.Blog by David Lutterkort is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.
Generated with Jekyll