How to store Apple Photos library on a NAS

Background

There are a lot of benefits to using cloud storage like Dropbox and iCloud. I love the ability to sync across devices and to access files on the go. However, I don’t think they’re a cure-all for all our digital living needs.

Some folks want greater control over their files. That’s why I invested in my own personal server, a Synology NAS. I have a 4-bay machine that’s got enough redundancy to ensure I don’t lose anything if one of my drives fails.

I like this solution because I can get a lot of the same benefits of the cloud storage providers without having to pay annual fees. Yes, the initial set up can be expensive, but I use my NAS extensively, especially the Plex application.

I’ve always been a bit of a digital pack rat, so my NAS allows me to squirrel away all my files, including my large digital music library and several large photo libraries. Now, if I did worked with my photos a lot more, I’d probably be more interested in paying for iCloud, but my libraries are mostly archival repositories.

The Problem

If you want to work with photos locally you need local storage space for your Photos library. As we increasingly rely on laptops with limited SSD storage capacity, this becomes a problem.

You can’t simply copy your Photos library to your NAS either because the NAS file system is not compatible with Apple Photos. If you ask about storing Apple Photos libraries on a NAS on the Apple forums, you’ll inevitably be told a version of this.

It’s true though. The native file system on a NAS isn’t compatible with the Apple file system.

So, how can you keep a massive Apple Photos library on a NAS and still ensure it works smoothly?

Caveat: This solution assumes that you have a single library, or are working with a single library at a time and DO NOT want to sync your library across several machines using your NAS. That is much more complicated, and frankly I don’t know if it’s even possible. This is based around the idea that one person wants to manage their Photos library in one place.

Disk Images to the Rescue

The solution is to use disk images. If you’re not familiar with disk images, here’s a helpful website that provides some details about how to use them. (I’ll pull some relevant info from this site below.)

The specific type of disk image we want to use in this situation is a sparse bundle. The advantage to a disk image is that it functions like a partition on a disk, but you can format it as an Apple file system. That means you just need to mount the image and anything stored in it functions the same way it would as if it were on your local drive.

Moving Your Photos Library to a NAS

  • Create a sparse bundle on your NAS
  • Mount the sparse bundle on your local machine
  • Copy your Photos library to the mounted disk image
  • Double-check that everything works as intended

Create a sparse bundle

I’m assuming that you already have your NAS connected to your local machine (and that it’s a persistent connection).

First you want to open Disk Utility. Go to File > New Image > Blank Image… (or simply use Command-N). This open a new window with a bunch of options.

I navigated to the photos folder on my NAS and that’s where I’m going to create this sparse bundle.
  1. Give your disk image a name.
  2. Determine the size you want. (More on this below)
  3. Choose the format for your disk image. I’ve selected Mac OS Extended because that format is better for mechanical drives. If you’ve got an entirely SSD NAS you should use the AFPS format, as that is optimized for SSDs.
  4. Select ‘sparse bundle disk image’ from this drop-down list

Once you’ve got everything the way you want it, click Save and you should be good to go!

Mount the sparse bundle (i.e., find the file and double-click it) and it will show up in your Locations list in the Finder. At this point, you can manually move your Photos library from your local drive to the sparse bundle.

Once that process completes, open the Library from the mounted sparse bundle disk image and everything should work as expected.

Some Notes on Size and Space

Let’s get back to the disk image size question for a moment here. For more information on how the sparse bundle actually functions, again, I recommend this page.

The basics are this: When you create the disk image it’s very small. As you add data to it, the size of the disk image increases up to the maximum disk size you set when you created it. So if you’re dealing with photos and video, you probably want to give yourself a lot of head room.

When you delete something from inside the sparse bundle, the size of the disk image doesn’t change. This has to do with how the sparse bundle handle storage (see the link above for the technical explanation).

It is possible to reclaim space in your sparse bundle, but it requires you to use Terminal. To do this you need to un-mount the disk image and then run the compression command. (The following is taken from the linked site.)

To un-mount your disk image, click the eject icon in the finder, or use the following command in Terminal:

hdiutil eject /Volumes/[ImageName]

Now you’re ready to reclaim space and remove any un-used bands:

hdiutil compact /Volumes/[path]/[filename].sparsebundle

Final Thoughts

I found this solution to be really useful. My whole family uses my NAS and my wife was running out of space on her laptop for her media and photos. So, I created a sparse bundle for her library, which she now uses. I also have a sparse bundle for my library that I use on my local machine with both Photos and PowerPhotos.

I mention this to emphasize that this setup has a one-to-one relationship in mind. We each have separate libraries we’re managing with our respective local machines. We do NOT have a family library in a sparse bundle that we’re accessing from multiple machines.

If you want to try that, do so at your own risk. It may work out ok as long as only one person mounts and works in the disk image at a time. Trying to collaborate in real time may really mess things up and you don’t want to lose your library, so be careful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: