Friday, January 27, 2012

Adobe Photoshop Lightroom: How I Share Catalogs Across Different Devices In a Networked Environment

During my workflow as an amateur photographer I'm using Adobe Lightroom and Photoshop on Mac OS X. As many of you already know, Lightroom does not allow you to use a catalog on a network share. That doesn't mean, however, that all your hopes of easily replicating it across different devices are lost. This is what I'm doing and to replicate it you will need:
  • An NFS server: there are many operating systems that can easily be configured as NFS servers. The quickest way to go it's probably GNU/Linux. Personally, I opt for Solaris and I'll tell you why in a few minutes.
  • The ability to mount NFS file system from your client devices: this is easily accomplished in every operating system supported by Lightroom.
  • A way to easily synchronize your catalog across the different client devices you will use. I use rsync.

NFS Server

My photos are stored on remote storage, published using the NFS protocol, and accessible from any client I need to work from. The NFS server in my home setup is not only the place that publishes my data: it's also the place that stores it. Personal data is valuable. That's why I'm replicating it in a configuration of hard disk drives with a high level of redundancy. Even so, really important things are backed up regularly. Do not use non-redundant storage for long term storage of your data. Stay away from those cheap "storage servers" built into a single disk drive. No matter how good the brand is or how much it costs, any drive will fail: you just don't know when it's going to happen.

The first difficulty to overcome when dealing with personal storage is: easy of use. I bet many of us would not adopt a solution, no matter how good, that badly impairs our user experience. Fortunately, though, it's very easy to build a relatively cheap home storage solution that fulfills all our needs. However, I'm not going to explain you how: just search the Internet and you'll discover plenty of different options that are available to you.

My home storage solution is built upon Solaris. Explaining why and all the benefits I enjoy would be too extensive: I'll just say I love the ZFS file system. ZFS and Solaris are the stone that killed so many birds that I don't imagine living without it.

First of all, it's ridiculously simple to export a ZFS file system using the NFS protocol. In some cases I export other kinds of target, such as iSCSI, which I need to have Time Machine working onto remote storage. If you're interested, you can check an old post about it.

NFS Client

Once you've installed your favorite NFS server of choice, it's time to use it. Windows ships with good and native NFS support at least since Vista and if you're using ZFS you will also be able to access ZFS snapshots from the Windows UI. UNIX and UNIX-like operating systems, such as Mac OS X and GNU/Linux, usually have good NFS support as well.

If you're using Mac OS X, mounting an NFS file system is a no brainer. Just open the Finder, select Go/Connect to Server… and just write the address of your NFS server.

Finder - Connect to Server...

OS X will mount the NFS share and it will appear as a new network drive:

Finder - Mounted NFS Share Mounted Displayed as a Network Drive

When organizing photos in Lightroom, just store them into this drive. As far as it concerns Lightroom, there's absolutely no difference when working on photos on your local hard disk or with photos on a network share such as this. In the next picture you can see the Folders panel in Lightroom Library module showing how I'm storing my photos on that NFS share.

Lightroom - Folders Panel

Synchronizing the Catalogs

Now everything but one thing, the catalog itself, is stored on the network in a location accessible from all your clients. The last problem is synchronizing the catalog across devices.

Of course, I'm using an NFS file system to store a copy of the catalogs too. The only thing we need to do is:
  • Synchronize it on the NFS share when leaving a device.
  • Synchronize it back from the NFS share when using another device.

This sounds difficult but it absolutely is not. Moreover, always performing a synchronization of your catalog is a good practice that will protect you from losing it because of missing or improper backup policies.

You might be wondering that the synchronization of a big catalog could take a lot of time. Well, it certainly could, if done naïvely with the inappropriate tools. A tool such rsync, for example, will help keeping synchronization times to a minimum taking care of just synchronizing the differences between the two catalog copies.

Another good news for Mac OS X user is the following: Mac OS X ships with rsync, you won't need to install anything on your Mac OS X devices.

Synchronizing an entire directory tree with rsync is "trivial", but it requires some command line proficiency:

$ rsync -az --inplace --delete [local-catalog] [remote-catalog-parent]

rsync has got plenty of options: the previous command is a good starting point to begin synchronizing your catalogs while you learn using rsync.

To synchronize the catalog back to another device, just change the source with the target:

$ rsync -az --inplace --delete [remote-catalog] [local-catalog-parent]

In my case, for example, I'd run the following line when synchronizing a catalog to the NFS server:

$ rsync -az --inplace --delete /Users/enricomariacrisostomo/Pictures/Lightroom /Volumes/enrico/lightroom-backup

On the other hand, when I need to synchronize a local device against the remote catalog, I just run the following:

$ rsync -az --inplace --delete /Volumes/enrico/lightroom-backup/Lightroom /Users/enricomariacrisostomo/Pictures

A Word of Warning: do not use trailing slashes in the previous commands unless you know what you're doing. If both source and target are directories, and you're not using trailing slashes, rsync will synchronize the source directory into a subdirectory of the target directory. In the previous example, rsync is creating a Lightroom directory inside lightroom-backup.

To speed things up, just create shell scripts with your synchronization commands and run them when you need them.

These commands may sound scary if you're not accustomed to using the terminal. However, I think the benefit is worth the trouble. If you don't want to fiddle with the terminal, ask a friend of yours to write the scripts for you. Also, you may find decent rsync GUIs out there, should you prefer using one.

Just to give you an idea of how efficient rsync is, here's an example: I just imported 20 RAW files into a catalog of mine and worked on them. This catalog is managing more than 10.000 images and is made up of more than 45.000 files. Here's the tail of the rsync output log of the last synchronization:

sent 34421438 bytes received 231055 bytes 2772199.44 bytes/sec
total size is 16648567921 speedup is 480.44

Pretty fast, isn't it? When you get used to it, you can't live without it.

Further Steps

Depending on how your catalog is configured, you may want to synchronize your Lightroom presets as well. Please check this post for further information. The technique to synchronize them will be exactly the same technique we used for catalogs.

If you want to help me keep on writing this blog, buy your Adobe Photoshop licenses at the best price on Amazon using the links below.

No comments: