Move Itunes Library From Mac To Synology Nas

Finally I installed Synology’s Cloud Station Backup Mac client on the Mac Mini and told it to monitor the photos directory and mirror those files to the Synology. It’s configured to only add files, not delete them. That way, if my library is ever accidentally wiped, it won’t also delete the files from the Synology backup. In the Choose iTunes Library dialog, click Choose Library and select the iTunes folder on your external drive. This can be enough for iTunes to properly associate itself with the copied library.

iTunes is something a whole lot of folks tolerate. It's never been the best at any particular thing (except perhaps activating and syncing your iPhone or iPad, where it's the only official game in town), but it certainly does a lot of stuff. Sometimes slow, sometimes crashy, and perpetually gaining features, it's the app we use every day but rarely with any joy. One of its more frustrating aspects is its lack of an officially supported server component—Apple seems stubbornly unwilling to provide a real iTunes server, and so folks who would otherwise happily centrally locate a media library on a perfectly suitable NAS are stuck with islands of music.

Building a central multi-user iTunes server that works consistently and well— that's also easy to configure and maintain without needing remote administration tools or command line hackery—is annoyingly difficult. However, it is relatively easy to take your iTunes library and simply move it to a NAS. It's not the house iTunes server we wish we had, but it does get your data off of your computer's local hard disk drive.

Why would you want to do this? The reason that pushed me down this path is solid state disks. As iTunes libraries go, mine's middle of the road—about 50GB, made up of a mixture of music, audiobooks, and iOS apps but lacking movies, TV, and podcasts. Still, that's 50GB of SSD space that would be taken up by files which, frankly, don't particularly benefit from being on an SSD. I could relocate them to an external drive, but I don't have any spare external drives with enough capacity. What I do have, though, is a Synology DS-412+ with plenty of space on it.

So, I chucked my library onto my NAS. The process was both far easier and far more difficult than I figured it would be.

What we're not doing

Let's be clear going in: this is not a guide on how to set up an iTunes server. We're not going to describe how to get your music centrally situated and available as an attached library for all your iTunes clients. There are lots of ways to do this, but they just don't stand up over time. Regardless of the method, there are drawbacks and caveats galore. Even third-party tools which automate some of the annoyances are at the mercy of iTunes updates breaking everything.

We're not going to talk through any of that stuff—not in this article, anyway. We're focusing only on taking your iTunes library and relocating it out of your home directory and onto a NAS (though the instructions will work mostly the same with a direct-attached external drive).

Prerequisites

One thing that you do need to have turned on is iTunes' library management function. This option has gone by many names in past versions of iTunes, but as of version 11 it's in the 'Advanced' tab of the iTunes preference pane. It reads 'Keep iTunes Media folder organized.'

Mac

This option gives iTunes control over where your media files live. When enabled, iTunes takes care of the file names and folder structure of your media library. This is an anathema to some folks, especially music collectors with their music carefully organized into expertly curated deep folder structures, but it's a requirement for this process. The movement of the library is an automated thing, and it relies on iTunes being able to automatically place the files where they need to be placed. If you've never toggled on that option, you'll need to do so in order to play along here.

Also, you need a NAS, or at least another computer with an available network share. You can follow along with an external drive, though not all of the steps will be applicable.

Why not just copy the files yourself?

Excellent question! The answer is that you totally can, but you'll lose metadata—play counts, ratings, last-played dates, and everything else that iTunes keeps in its database won't survive a manual copy. If you don't care about that stuff, then you don't need to do anything in this guide at all—leave the 'Keep iTunes Media folder organized' option set to off, remove all your files from iTunes (taking care not to actually delete them!), copy them to their new location, and re-add them to iTunes. Done!

Advertisement

However, if you've got a whole mess of ratings and other metadata you'd like to preserve, keep reading.

Getting started

To start, make sure the network share you want to use is mounted, and that you've got the correct permissions on it. Create a target directory inside the share, so that you have a specific folder to point iTunes at.

I've got a share on my Synology NAS called 'Music', and inside that I've created a folder named 'NAS iTunes'.

How To Transfer Itunes Library To Synology Nas

How to transfer itunes library to synology nasMove itunes library from mac to synology nascar

Next, pop into iTunes, open the application preferences pane, and click the 'Advanced' tab. The very first thing in the window is the 'iTunes Media folder location' box. Click the 'Change' button next to the box. You'll get a file picker dialog box, which you should point at the network folder you've previously created.

When you click 'OK' to close the Preferences pane, iTunes will ask you if you want to move and rename files in the new location to match the 'Keep iTunes Media folder organized' preference— say yes.

Now to actually move the files. This is easy, but it's also where my trouble started. Select File > Library > 'Organize Library.' This will start what could be a very long file copy, and if the copy completes successfully, you're probably done!

It might not complete successfully, though. I had several issues.

Dealing with trouble

Almost immediately, the copy job failed with a cryptic, absolutely unhelpful error message that said, simply, 'Copying files failed. An unknown error occurred (-50).' Googling the error led to a large number of results but no clear solution: it appeared that error -50 is iTunes simply throwing up its hands in frustration and crying out for help. Worse, the location of all my iTunes music had been altered in the library, so a quick perusal of iTunes showed that every single item in my library was now listed as missing.

However, the problem actually turned out to be not entirely iTunes' fault. The library consolidation failed when iTunes attempted to copy a song with a very, very long file name (for the curious, it was a song by The Video Game Pianist titled 'Sonic the Hedgehog 1 - Green Hill Zone, Stage Complete Theme, Labyrinth Zone, Marble Zone, Sonic Drowning Theme, Game Over Theme, Starlight Zone, Chaos Emerald Theme, Scrap Brain Zone, Spring Yard Zone, Game Over Theme, Extra Life Theme, and Ending Theme'). This bumped right into the 255-character filename limit on the Synology's ext3 file system, and the entire copy job aborted.

So, lesson one: know your target filesystem.

How to transfer itunes library to synology nas

After shortening the file name, I ran into the second problem: re-selecting File > Library > 'Organize Library' no longer did anything. The first thing iTunes did before even starting the copy was update its internal library so that all its contents' locations were set to the new Library location, so as far as iTunes was concerned, everything was already copied. I had to manually copy my library to the new location.

Move Itunes Library From Mac To Synology Nas

This led to a third problem. The Synology NAS's ext3 file system, unlike the HFS+ on my local disk, is case-sensitive. A huge number of files in my library were suddenly showing up as missing, even though a spot check showed that the files were actually right where they were supposed to be. Manually re-linking them caused iTunes to automatically reorganize them to folders and file names that exactly reflected the files' metadata, leading to situations like this:

Notice that there are two 'The Best of 1980-1990' folders, one with a capitalized 'Of' and the other with a lowercase. Fixing this required quite a bit of song tag editing. Fortunately, the automatic library organization actually worked for me here, handling the deletion of extraneous folders after I'd fixed the song names. In the example listed above, once I'd found the one single song in the upper-case 'The Best Of 1980-1990' folder and modified its album metadata with a lowercase 'of,' iTunes moved the song to the correct folder and deleted the uppercase one. Still, tracking down all the exceptions took several hours.

Advertisement

Move Itunes Library From Mac To Synology Nasa

Lesson two: know your target filesystem.

The third and final issue I had was due to my library's age. I've been using iTunes since about the time it was released for PC near the end of 2003. My poor library has been with me since, surviving version upgrades from 4.1 to 11, even going through a platform switch from Windows to OS X near the end of 2007 when I converted. As iTunes has gained features, it's directory layout had changed, and as a result I've got crufty extra directories and files stored all willy-nilly behind the scenes.

For example, underneath the iTunes Music directory is...another iTunes music directory, with a bunch of orphaned files in it.

That directory also contains a huge number of folders with more music.

And, inside of that, there's yet another Music folder, with, you guessed it, more orphaned music:

When iTunes attempted to consolidate my library to the NAS and the copy aborted, it also looks like it attempted to clean all of this up, fixing the iTunes database so that in the new location, everything was located where it should be in the current iTunes automatic organizational scheme—in album-named subdirectories under a single top-level folder. Because of the failed copy job, this didn't happen.

Because of the scattered state of my aged library, I had to then spend about another hour going through the library, re-linking missing files. This wouldn't have happened if the initial copy hadn't failed, which wouldn't have happened if I'd not had that one tremendously long file name.

Lesson three: For the love of all that is good and holy, know your target filesystem.

Auto-mount network shares

Move Itunes Library From Mac To Synology Nas

One final thing needs be done: with your library on a network share, it's important for that share to be mounted before iTunes starts up. For Windows users, this means that it's a good idea to assign your 'Music' NAS share a drive letter and set it to auto-mount on startup; OS X users can do the same thing by adding your Music volume to the 'Login Items' section of your account under the Users & Groups system preference panel. If you start iTunes without having its NAS share mounted, it will freak out and say all of your library files are missing.

Eventual success

After quite a bit of clean-up, the end result works quite well. The actual iTunes library file with its metadata is still on my local HDD, but all of my songs, iOS apps, and audiobooks are safely on my NAS. New files dragged-and-dropped into the library or new iOS apps downloaded from the app store are all automatically stored on the NAS in the library location. Now that the initial work is done, the system is self-maintaining.

Move Itunes Library From Mac To Synology Nashua

Folks with small iTunes libraries won't see much benefit from this, but if you've got a tremendous amount of stuff in your iTunes library along with some external space to store it, this is an excellent way to give you back a whole bunch of space on your boot volume.

This method works well with local disks, too, so if you have a big USB or Firewire external drive and you want to put your media on that, simply setting it as the library location in iTunes should do the trick—you won't even have to deal with the file system issues I had, since a locally attached external disk will almost certainly be formatted with the same filesystem as your source volume.

Move Itunes Library From Mac To Synology Nassau Bahamas

It's not a whole-house iTunes server for multiple users, but it's a step closer. Stay tuned, though: we'll look at some methods for achieving a full-on iTunes server in the near future.