For a while now I've been faced with a problem which really should have had quite a simple solution in today's internet-enabled computing world: file synchronisation.
Like many people, I'm sure, I do a large amount of work on the desktop PC in my office. I also do increasingly more on my laptop. (In actual fact, I tend to do more on my laptop, but that's another story). I then have the problem of where my files are kept. Years ago, the answer would have been fairly straightforward: a floppy disk. As time moved on, perhaps a zip disk or USB pen-drive would have been used, but to be honest, I now have such a lot of data that I'd need an external hard drive to keep it all on, and that isn't always practical to carry around. Added to this, it wouldn't feel a very secure system to me, even if I did back it up regularly, and sometimes I'd like to be able to read the same file on more than one PC. Perhaps in this networked world I've grown to expect too much from my computer(s), perhaps not.
Email is something which has got the whole problem pretty well sorted. Probably the majority of people in the world now use webmail systems of one sort or another. Those, like me, who prefer to have a copy of the emails on their own systems often make use of the IMAP protocol to allow our mail clients to automatically synchronise between multiple locations. And IMAP has worked remarkably well for me for over ten years. KDE quite niftily also allows me to store my contacts and calendar in IMAP folders, so that they are too accessible from anywhere with internet access or a local copy. Great stuff.
So, why is it so difficult with files? I remember vaguely there being something called "My Briefcase" on an old version of Windows I used to use, but I never really needed to back then or spent any time getting to grips with it, but I've found nothing similar on any linux system, and I'm told the functionality has now disappeared from Windows too. (Perhaps it's been replaced with something else... I don't know.)
A few months back, looking around for a solution to my file synchronisation problem, I discovered rsync, a fairly old tool, developed for creating mirrors of things such as FTP servers. I played around for a while with rsync, and found it quite useful, but the main problem was that it was only really intended for uni-directional syncing. This is fine for backing up one computer to another, but when I often work on both, I need something which can deal with the fact that changes could have occurred on either machine.
I asked around on a few mailing lists, and it was suggested that I try Coda. Rather than being just a tool, Coda is a filesystem, a bit like NFS, but offering "disconnected operation for mobile computing" according to their website. Great, I thought, sounds just like IMAP, and what's more, it's been around since 1987. Unfortunately, Coda proved to me to be an enormous headache, and after quite a lot of wasted time, I still didn't have a functioning implementation of it (its configuration is most definitely not for the faint-hearted). It appears to me that the idea of Coda has been around since 1987, but in practice it is, again according to its website, merely "promising".
So, I was back to rsync. A few months ago, I settled on the use of a few hand-written and easily breakable shell scripts which called rsync to mirror my files in either direction at a time. The scripts relied on some flags, set by the scripts, to determine which machine had the 'current' copy of the files. In essence, I was able to check files in and out of the desktop machine (which was behaving like a server) to my laptop. It just relied on me knowing which one I was supposed to be working on! A lapse of memory on my part would unfortunately lead to the updates on the non-current machine being wiped at the next sync.
This week, thanks to my friend Edd, I have discovered something which I'm hoping will be the end to my woes: Unison. Unison appears to be a kind of hybrid of rsync and CVS, and claims to allow updates to take place on either machine (providing that they're not on the same file), and then merged together. It's free software, in the Ubuntu repositories and even has a nice little GTK+ GUI as well as a command line interface. So, I'm suspending use of my rsync scripts for a bit, have backed up my files, and will give Unison a whirl. So far, it seems very easy to use. Though frankly, why this kind of functionality isn't completely standard by now, I don't know.
File synchronisation from PC to PC? For standard 'office' of files, this would be a complicated way of solving a problem that's already been solved in a more simple way.
I now use an online office suite (Google Docs & Spreadsheets) to store and edit documents that I want to access from multiple locations. Whilst the level of functionality in these online applications is less than, say, Open Office, for most types of documents they are more than adequate.
For work-documents, these are accessed using the virtual private network, again meaning that storage is not an issue.
Granted, online office suites may be no good for the sort of files you work on (source code?), so maybe the above doesn't apply to you.
Interesting. To be honest, although I can see the benefit in certain circumstances, I'm not really interested in using online office suites. There are three reasons why:
Firstly, since I rarely use office-type programs anyway, I don't really feel the need. To be honest, these days most of my files are statistics, code, graphs, latex etc.
Secondly, I'm getting really fed up with having to interact with my computer through rather narrowly defined web applications (think facebook for messages rather than good old email, web forums instead of mailing lists and newsgroups - all my opinion though!)
And thirdly, I want my free software thanks, and I want the stuff all under my control.
I guess I should have said more clearly that what I need is the ability to disconnect from the network and still have all the files there. VPNs and other online storage systems including online office applications, as far as I'm aware, don't allow this.
Anyway, Unison is really a very simple system, I just took a complicated route to finding that out!
I was thinking of subversion when I read this. I let it run on my webserver and now, whenever I write stuff that is not hosted ans synchronozed on some svn server, I feel insecure :) However, the advantage for you on unison seems to be that you do not need a server to host the repository, which sounds nice.
What does it mean with "propagating changes", though? Does it merge (text) files like subversion or simply replace older versions with newer ones?
Post new comment