September 9, 2013

I had a bad experience when I was a kid. I was taking apart my computer to heat-shrink the cables, like all 14 year olds do. I had taken the plastic end cap off of the hard drive power cable and was extremely careful to keep the cables in the correct order. What I wasn't careful about, however, was the orientation of the plastic cap. I put it back on upside down, reversing the order of the cables. When I plugged the cable back in to the drive 12V was sent to the board instead of the 5V it expected and the drive started smoking. I tried everything to get the data back, including expensive data recovery. All to no avail. Not a good day, I had permanently lost a lot of photos and projects. From then on, I've had a pretty extensive backup strategy that has saved me several times.

I'm going to talk mainly about how I back up my Aperture photos, because it's a huge amount of data and they are extremely important to me.

Reference or Manage

In Aperture you have two options when it comes to dealing with your images, you can either let Aperture manage them, or you can reference them off your hard drive. I much prefer the latter. With referenced images, you have full control over the directory structure of your master images and it makes it a lot easier to do your backups.

First Level - Online Backup

I store all of my originals on an external hard drive that is attached to my iMac. When I first import my photos, I store them on my local drive in an "Aperture Holding" folder. I use cloud backup service Backblaze to backup my computer to the cloud. Backblaze is great because they offer unlimited backup for five bucks. Including external drives! I've got a couple of terabytes in their cloud. Thanks for all the space Backblaze!

If I ever lose any of my photos, I can login to Backblaze, hit restore, and bring down a zip. Because photos can be so big, that's not an ideal solution for restoring a whole library, but it has saved my hide in scenarios where I realize I've accidentally deleted some photos. You'd think I'd learn.

Second Level - Physical Media

Here's where it gets interesting. The second level of backup I have is DVDs. Good ol' optical media. One of the glorious, life-saving features of my optical media strategy is that failures can't cascade. I had an instance where some of my photos got corrupted and Backblaze happily backed them up (as it should have), but suddenly that backup was useless. The DVDs, however, were sitting in my closet, unaware that they should be corrupted. I popped in the matching DVD and overwrote the corrupted files and everything went back to normal.

The key to backing up to physical media is having a system. And boy do I have a system. I make use of Aperture tags, Applescript, Automator, and a little bit of bash. You can totally implement it too though. Let's take a look.

The "Not Backed Up" Album

After a photo is backed up, it is tagged with the "DVD" tag. That way I have a smart album that simply selects every photo that isn't tagged with "DVD". I know that those photos are in mortal danger and need to be backed up pretty soon. But as a geek, there's no way I'm going to do that manually every time. So how do the photos get backed up and tagged with "DVD"? Enter Automator.

Automator

Automator is an extremely powerful, underused Apple program. It allows you to automate a wide number of programs so that you don't have to repeat actions. The first automator action I use is really just an Applescript that tells you the size of all the images you have selected. The way I use this is to go into my @Not Backed Up Album and select a bunch of images, click the "Calculate Size of Selected Items" service, and try to get as close to 4 gigabytes as possible. (DVDs hold 4.6 Gb of data, I like to leave a little wiggle room, just in case.) Once I get around the 4Gb mark, I've got my selected set of images for the new DVD backup.

With all of those images selected (that total to ~4Gb). I select the "Burn Masters to DVD" service and sit back and marvel at the power of Automator. (You can download the automator actions here: https://s3.amazonaws.com/aaronfrancis/aperture-workflows/workflows.zip. Place them in your Users > YourName > Library > Services folder.) Below is a photo of the main action. Don't freak out, we'll go over it.

Whew. Ok. Right off the bat, it's going to ask you to make sure a DVD is inserted. Everything will go horribly wrong if you try to burn a DVD when no DVD is inserted. The next thing it does is reads the value out of a file. This is just a simple text file with a single number in it. You'll need to create a .txt file and put the number 1 in it. That's all.

Once you've done this, change the reference in step two to the path of your new text file, not mine. The Applescript will read that variable and add enough zeros to make it a three character string, like "001" or "010" and then pass it to the variable "Name". This is going to be the name of your DVD and your backup tag.

The next couple of steps takes all the selected images and exports the masters to a folder that you designate, getting ready to burn them to a disk. There's an action called "Get Folder Contents" that takes all the items from that Temporary folder and passes them to the "Burn a Disc" action that actually does the burning. Once the disc is burned, we throw away the temporary folder (the masters still exist, it's the temp folder that is now gone) and eject the disk.

The last thing we need to do is tag all those images with "DVD" and the backup number in Aperture. The Applescript will go through and tag them all for you. In addition to the number (from number.txt) it will look for a file called letter.txt and put that at the front, so make sure you create a letter.txt file and update the reference to the location of that file. I just put "A" in my file, you can put anything you want. You can put "backup-" and the tag will come out to be "backup-001". Mine are "A001, A002, ....". That's just my system though. If I ever get to 999 I'll change the letter.txt to "B" and update number.txt to "1". Unlikely to ever happen though!

Once the tags are finished, a (hacky) shell script tries to increment the number in the file by one, getting you ready for your next burn. (There is probably a wayyy cleaner script for that part, but hey, it works!)

Should Something Go Wrong

I've found that sometimes the tagging part can fail, so I made another action that just does the tagging, should it fail. Don't deselect the photos until it's done so you can ensure that you can just hit the "Tag Selected With Backup #" action. Once you deselect the photos, they'll disappear from the @Not Backed Up folder, leaving you with any other photos that need to run through the system.

The Discs

I write the name of the backup ("A029") and then the date on the disc. I buy the discs by the 100 and store them on the spools that they originally come on. I take one off the top, burn it, write on it and then put it on the bottom of the stack. Easy enough.

Every single photo in my Aperture library is tagged with "DVD" and "A0XX". Every photo I look at, I know there is a corresponding DVD in my closet with a copy of the photo.

Third Level - Classic Backup

For the third level, I use a classic backup strategy of just replicating my external drive to another external drive. You could use time machine or any other number of back up tools like that. This is probably (definitely) the least interesting, so I won't really talk about it.

Am I Crazy

Maybe. But hey, I had a bad experience. Eventually you will lose something too, it will happen. I guess I'm lucky that I lost stuff at 14 when I had no kids, no serious professional work, or any client data. What about you? What important things do you have and how do you ensure they'll never disappear? You do ensure that, right?