iTunes: Multiple library locations and preserving the metadata (and multihoming iPods too!)

I have pretty much given up on iTunes gracefully handling a media library that spans multiple hard drives. I really like the “Keep iTunes music folder organized” as it makes it much easier to go traipsing through the library. As well, I use “Consolidate Library…” all the time. The latter truly insisting that all media live under one folder — on one device.

Since hard drives are ultra cheap, it really isn’t a problem right now. My library is just under 200GB and I have it living on a 500GB My Book. Finally, I have scanned nearly my entire CD collection (224kbit AAC — once drives are cheap enough, I’ll go for lossless).

Of course, backups pretty much require backing up to another hard drive (or drives — I would rather have multiple copies of this much data, just in case). Now, wouldn’t it be nice if said backup were also usable from within iTunes on another machine?

Easy enough.

(1) Relocate your music library and metadata to an external hard drive. This is a combination of first moving the metadata out of ~/Music/iTunes*, launching iTunes with the OPTION key held down, and then using the advanced menu item to point to the new music location.

(2) Backup the library with rsync:

Assuming you are on the machine that will act as the backup, do the following every now and then:

rsync -a -v --progress --block-size=128000 mastermachine:/Volumes/Music/ /Volumes/Music/

At this point, you’ll now have a complete copy of the music and metadata from your master machine on the local machine’s “Music” volume.

If you do exactly what I have done, even the paths will be the same. You merely have to launch iTunes with the OPTION key held down to re-home iTunes to the metadata found /Volumes/Music/.

If the volume name is different or you are rsync’ing to a sub-path, you’ll need to also set the advanced preference to point to the top level music directory. You can tell if you have set it correctly by whether or not the music can actually be played.

Now, the iPod part…

I discovered that if I connect an iPod to either machine, iTunes does not warn that the iPod is connected to another iTunes library. The iPod is quite at home on either machine.

The end result is that I can now treat my master machine as just that — the master. All metadata updates, etc, are sync’d to that machine. Whenever I rsync, the metadata is propagated out to the backup machine(s). I can still plug the iPod into any machine and it will sync down new music based on my neat little set of smart playlists.

If I produce additional metadata on the iPod in the form of song ratings (and, of course, “last played data” that I might care about), I simply need to remember to sync it to the master machine.

Of course, this all just accidentally works. So far, it works well enough. I’m not worried about data loss as everything between the iPod and iTunes seems to be rather transactional in nature. That is, there isn’t some kind of a bulk binary database load from the iPod into iTunes. If the iPod is hoarked, it is just a matter of restoring it to the factory settings with the updater.

Deprecated: link_pages is deprecated since version 2.1.0! Use wp_link_pages() instead. in /srv/www/friday/bbum/wp-includes/functions.php on line 4713

8 Responses to “iTunes: Multiple library locations and preserving the metadata (and multihoming iPods too!)”

  1. n[ate]vw says:

    Great info. From your description, it sounds like I’d also be able to share a single copy of my iTunes library with multiple computers via a network share. Now that iTunes has all the fancy artwork functionality, and I’ve found the “Sing that iTune” widget to help me gather lyrics, I’m hoping to invest some time gettting my library in order. But I have my own organization preferences, and want to keep everything except the digitally restricted media *outside* of the library. I think it will still work though: all my ripped music in one folder, and my iTunes library shared between my several computers via a share. I wonder how confused iTunes would get if I shared between Mac/PC versions as well as a mix of v6 and 7……

  2. bbum says:

    I doubt if iTunes is going to handle multiple clients accessing the same metadata database (the ‘iTunes Library’ file is a database of some kind, as far as I can tell). Or, at least, it’ll likely lead to exclusive access to one client only.

    Sharing the media via a network share shouldn’t be a problem. You would likely have to remember whatever has been imported on the master and then re-import into the slaves.

    Really, someone should write a bit of code that syncs the metadata between different libraries. I wonder if the iTunes scripting dictionary is rich enough to do so?

  3. Nathaniel Nutter says:

    Is the –block-size=128000 option necessary or is just there to increase performance?

  4. bbum says:

    It increases performance when dealing with really large files. Not really necessary, but a vast improvement when dealing with a large media file that has had a change to ID3 tags.

  5. stingerman says:

    You can share over the network, but the danger is that multiple computers writing to the data files. So, you just need to designate one machine as the master and only that one can add or make changes to the library, all the other machines should be read only.

  6. bbum says:

    Given that iTunes writes a bit of data after every play of a song, I am not sure if it has a notion of a truly “read only” library. Probably not.

  7. bbum’s weblog-o-mat » Blog Archive » iTunes Library Backup, rsync & cover art says:

    […] A while ago, I wrote about synchronizing iTunes libraries between a couple of machines using rsync while allowing for multiple locations. […]

  8. Gnarl says:

    Ok, I’m on Windows XP and don’t see ‘rsync’ as an available command… are you on a Unix based system or Mac? Can you point me at a Windows based solution?

    I’m trying to use a Mybook as my main music repository. Adding to it from a ‘sacrificial’ machine which has USB 1.0 but, works fine for burning my CDs while using my primary machine with USB 2.0 for loading my iTouch… I’m getting very tired of having to pull music in to the primary machine album by album though… and especially of having to burn the AAC after I copy the CD… is there an option to have it automatically convert to AAC? If so, I’ve not found it.

    Either way, thanks for the feedback and the ideas…

Leave a Reply

Line and paragraph breaks automatic.
XHTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>