iTunes Library Management

Here’s a useful little trick that somehow passed under my radar for quite some time concerning moving or using multiple iTunes Libraries.

The basics

An iTunes library is made up of two separate pieces: the library database (and some ancillary files) and the content. I’ve know for a long time that you can store the content on any available drive, and I’ve moved mine to the NAS due to the fact that it outgrew the 1Tb barrier of reasonably priced disks a few years ago and I am trying to keep the Media Mini as unencumbered as possible, given that it is front and center in living room, just under the TV.

Moving the location of the iTunes content is child’s play. In the preferences, you just need to set the default library directory and then use the consolidate feature (under File > Library > Organize Library…) and iTunes will happily copy all of the media files that it knows about into a nicely organized file structure in the selected directory.

But I’d been running into a separate problem (worse with earlier versions of iTunes) where after any changes to the library database, like updating the play count of a song that just finished, iTunes would write out a backup copy of the library database to an XML file. This is a very sensible thing to do since it ensures that if the database file itself goes bad, you’ll have a complete image of the contents that can be used to rebuild your library.

The problem I was running into was that since my library is rather large, this was causing iTunes to hiccup in the playback a few seconds into each song as it was trying to read the song file at the same time as writing out the database backup file. On a 5400 RPM internal drive, this was asking too much of the technology. Granted this is a rather extreme edge case as you need a very big library to run into this problem.

I went the easy route to solve the problem and replaced the internal drive with an SSD. Note: not really that easy since swapping drives in a modern Mac Mini is certainly possible, it’s not for the faint of heart and is an awfully fiddly process.

However, I just discovered that iTunes behaves the same way as iPhoto in that if you launch it with the option key held down, you can select or create a new iTunes Library. This is referring to the database file ending in .itl which keeps the index of your content. All I needed to do was to copy the contents of the iTunes Library directory to the NAS, start iTunes with the option key and select the copy on the NAS.

No more playback hiccups and this has the added advantage that the NAS copy of iTunes is completely autonomous now, including both the database index and the content together on the same volume. Which means that I can easily replace the Mini with another machine and get the library running simply by selecting the itl file on the NAS. The added bonus is that now the backup process ensures that iTunes is replicated and backed up as a complete package rather that having to marry together two separate sources of information.

Nice.