Over the past three months I’ve gotten myself used to checking all my projects into a pair of Subversion repositories, one for personal projects and another for all my client work. In both cases I’m the only person using them, so neither are your typical SVN use case scenarios, but I’m still finding my system enormously handy for a few reasons:
- I work off two computers during any given week, and though I’ve been good about keeping them synchronized, I have had the occasional few hours of work wiped out by a wrong-direction file transfer. Plus the mental overhead of manually keeping track of which files have changed meant I didn’t do it as often as I should.
- I have at least three copies of my work on hand, which means I’m well situated if any one or two copies crap out on me, or get stolen, or whatever.
- I can revert to a previous version of my work if I ever realize down the road I needed something from a file I deleted three months ago. This one is mostly theoretical for now, as I haven’t had to do it yet, but it’s nice to know the option is there.
But here’s the twist: my repositories exist on USB keys. I decided against storing them on a server, so I needed some other way to create relatively portable repositories. USB drives fit that bill. Now there are two immediate flaws with this setup:
- A USB key is a physical object that could wind up in someone else’s possession, through theft or carelessness or any other reason. I don’t want anyone else having access to work in progress or my personal files.
- Data Loss
- Also through losing the key, or through physical damage, my work could disappear.
The second point is relatively easy to shrug off: I have the master files in three locations, it’s just one of those that I’d be losing. Okay, so I’d also lose the change history, but in my mind the most important piece is the current master copy of the files, which I’d have safely backed up in two other places. So, while being forced to recreate the repository wouldn’t be ideal, it also wouldn’t be a huge hardship.
However it’s that first point that concerned me more. I had to get a little more proactive about securing the USB key, but luckily OS X makes that fairly simple to accomplish. Using the built-in Disk Utility (
Applications > Utilities > Disk Utility) it’s easy to create an encrypted disk image that protects its contents from prying eyes:
- Open Disk Utility, hit the “New Image” button.
- Give the image a name; I’d highly recommend naming it differently from your USB key to avoid confusion.
- Select your USB key from the left hand device listing.
- Select a size that will fit on your key. For an 8GB USB key I went with a 7.5GB disk image to account for byte count differences, though I probably could have gone a bit higher.
- Set encryption to AES-128.
- Leave format as “read/write”, then hit Create. Enter your password when prompted, and verify it. Do not lose or forget this password.
- Wait; it will take quite a while to write a large disk image over USB.
What you’ve created is a secondary virtual disk on the USB key, but this one’s encrypted. 128 bit AES isn’t uncrackable, but if it’s secure enough for classified government documents, it’s good enough to render the disk image useless to virtually anyone who doesn’t have your password.
Now to use this image you first need to manually mount it by inserting the key, then double-clicking on the image that sits on the key. You’ll know it’s mounted when you see two drive icons in your Mac’s device listing, one for the physical USB key and one for the virtual disk image.
Once the encrypted image is mounted you can read and write files inside of it like you would any other disk, so this is where the repository goes. I took the easy way out and just grabbed the latest beta of Versions and used it to set up my initial repository by pointing it at a master copy of my project folder on one computer, and then checking out the repository on the other computer.
And from then on it’s SVN as usual; my projects are kept up to date on both systems, and I can make changes on either end with the confidence that I’m not going to lose critical data. And this have been an extremely useful system for me, as evidenced by the fact I’m still using it religiously three months later. But there are a few minor quibbles I should point out.
I do have to keep swapping the USB key back and forth between machines (hence the term Sneakernet in the title of this post). I also need to hit eject twice every time I want to remove the USB key: once for the disk image and once for the USB key itself. I wouldn’t have to do this if I hosted the repository on a server somewhere.
I also need to remember to keep the key with me when I’m likely to require it; having it on my keychain was working fine for that… up until the metal clasp broke. But I’m also finding the process of checking in my work is making me more aware of when one computer or the other is out of date, and usually when I grab the MacBook to go work in a cafe or elsewhere I’ll remember that I need the USB key with me. So far so good, but I can at least see the potential for this being a problem now and then.
And finally, a USB key is limited in space; I’ve been checking in all my work, from HTML and CSS to PSD and AI files. Some of these are many megabytes in size, and the space requirement for multiple revisions is not insignificant.
While I can foresee the need to maintain the repository down the road by trimming the oldest revisions to free up space, I haven’t had to cross that bridge yet. And I also half suspect that simply moving the repository to a larger USB key will be the path of least resistance, as larger capacities are introduced and prices come down.