Sunday, January 16, 2005

Moving iTunes Libraries: the SMB version

iBook, iPod and OS X: News, Notes and References

On the one hand, iTunes is very adaptive. It can handle a lot of upset in where files are stored. On the other hand, Apple provides NO help with moving an iTunes library between machines or between files stores. Their support site mentions using an iPod to make the move; a technique that that's roughly the equivalent of moving a house by chopping it into pieces and throwing it in a large bin.

There are many ways to move an iTunes Library. OS X Hints has mentioned a few. This is only my experience -- and it's very anomalous.

Background

There are 3 parts to an iTunes Library. The first tow of these always travel together. The third can be anywhere, but the default location is set by iTunes. (Music folder, My Music, etc)
  1. iTunes 4 Music Library (PC version has the extension .itl): This is a binary file. This is the true iTunes database. I think iTunes gets the location of this binary database file from the plist file (Mac) or registry (PC).
  2. iTunes Music Library.xml: This is an ascii file. I think iTunes generates this from the binary file. It's used by applications other than iTunes. I believe one could delete this file and iTunes would regenerate it, I've not tested that.
  3. iTunes Music (may have other names): This is the folder iTunes uses for music it manages. If you import from CD, the compressed files are stored here. The iTunes database poins to music in this folder. In fact you can have many different folders with music on many different machines, all indexed by the iTunes database, but only one of them is actively managed.
Moving an iTunes library or hosting it on a different drive.

There are two techniques. The first technique leaves the iTunes database in the default location (user folder if you're using a Mac). The second technique, which is riskier but is the one I started with, moves the iTunes Library database too.

Technique One: Move the music only

This is the more official technique. Configure iTunes so it manages music (keep library consolidated). Use Consolidate Library menu item in the Advanced menu. In the advanced preferences change the location of the library. When asked if you wish to move the files, say yes. iTunes moves the files. The database doesn't move.

Technique Two: Move music and database to a remote drive

Once upon a time I moved all my iTunes music from my iBook to an SMB share. Alas, I'm not sure how I did it! I've since moved that music to a different SMB share. I sort of know how I did that. So this is really a reconstruction of what I think I did. It is probably not correct, but it might provide some insights.
  1. Copy the iTunes music folder, database files and music folders alike, to the server.
  2. Create a shortcut (alias) to the new music files.
  3. Remove the default iTunes folder and replace it with the shortcut.
  4. Start iTunes. You may need to use the Advanced consolidate library feature. (Astoundingly I think I did this and it worked, but I don't see why it worked. I think iTunes may use relative paths in the binary database, and updates the XML with abolute paths.)
I think Technique One is safer, if I were starting over I'd do that one. I was able to move the files from one SMB share to another but it was a hairy and error prone process.

Technique Three: Moving to a new machine

I haven't done this yet. I think it would go something like this:
  1. Consolidate the library as in Technique One.
  2. Copy the database files and the music to the default location in the new machine.
  3. Start iTunes.
Given that I keep iTunes in a remote SMB share, when I switch to a new machine I'll probably just have to swap the shortcut into the new machine's default music location. Now the trick will be moving the entire Library from an SMB share to the new machine. Hmmm. I might have to do something like this:
  1. Remove the shortcut.
  2. Copy the music files and database over to replace the shortcut.
  3. Fire it up and see what happens!

No comments:

Post a Comment