Question From A Reader: Mirroring an iTunes Library

Shawn writes…
…i’m looking all over these internets, and I have a feeling you can point me in the right direction.
Short short version: how can I mirror/sync the itunes database file (just the database, not the song files themselves) between two macs on the same home network, so that any changes made on one mac will show up when itunes is opened on the other mac? Foldershare doesn’t seem to be working…
I’m looking to:

  • Store my itunes library (the files) on my mac mini, storing no mp3’s on my macbook pro (this is done, easily, by sharing the mini’s itunes folder and pointing the mbp to it…got that done already…it’s the sharing of the database file that I’m having trouble with)
  • Either NAS or external fw/usb drives for saving music/movies/photos attached to mini (raid 1 or 5…I’d love to hear suggestions of why a NAS or external would be a better bet…I’m leery about capability of NAS to stream high quality handbrake rips through my elcheapo linksys wrt54g router…would love to get lacie Ethernet RAID, but I don’t think it will cut it)
  • Use that repository of files on the mini/nas/external drive whenever i’m on my home network…rip a cd on the mbp, consolidate, it shoots over to the mac mini, and occasionally clean off the mbp so it’s got no MP3’s stored on it
  • Reference either the same library database file or have a mirrored library file on my macbook that updates/syncs regularly, so I can access the library (add new podcasts, new music from cd’s, etc.) even if I’m not on my home network


  • if i’m out and about, and add a cd to the mbp, or a podcast, I can still sync my ipod…the easiest solution of just pointing the MBP to the itunes library database on the mini is problematic, because if I’m off the network, I can’t use that library database, and I’ll get a blank itunes library, and not be able to sync the ipod. If, however, I set it up like I’m wanting to, whenever I’m out and open up itunes, I’ll just get the ‘grey exclamation point’ by all of the songs (because the actual files are still housed on the mini/external drive). Then, when I get back home and onto the home network, any changes I made to the itunes library (playcounts, playlists, etc.) would be mirrored back to the mini…and vice versa, if I happened to change the playlists on the mini…though I’m not so worried about changes from the mini being mirrored back to the MBP…that won’t happen all that often.


  • I can’t get the damned itunes database file to mirror. I’ve tried foldershare to link folders between the two computers, and it *will* copy the itunes database over into each folder, but it loses some file information along the way: somehow, whenever it’s copied, the itunes database “turns into” a ‘unix executable file’, and is no longer recognized by itunes as a valid database file…I’ve looked at rsyncx (for about 15 minutes), but couldn’t figure out how to use it to do what I needed automatically.

Great question, Shawn. As you’ve found, this is much harder than it should be. I do have some tips you might try, but I never got all the way to a solution myself, and eventually settled with a one-way solution. I’ve posted everything I’ve discovered in the comments below. I’d love to keep this discussion going and see if we can’t find a way to get this done right…

9 thoughts on “Question From A Reader: Mirroring an iTunes Library

  1. Sorry for the delay in replying — its been a busy Christmas season. Unfortunately, I’m not going to be able to give you all the answers you’re looking for. Another author on the site might have some additional ideas, but he’s on a submarine right now, so I’ll just give you what I know.
    Solution A:
    If you can live with one very restrictive caveat, the easiest way to do what you want is a Symlink:
    – A NAS will work fine for hosting your media library on your network — even over 802.11G, provided the playback machine allows for a few seconds of buffering to make up for any interference (like someone turning on a microwave somewhere and stalling your network). If you can’t arrange for playback buffering, I’d recommend going old school, and running a good CAT5E cable.
    – Copy your iTunes library folder onto the NAS, and create a Symlink on each Mac that points the local “iTunes Library” to that remote folder. Use SymbolicLinker to make your job really easy.
    – Its important that the music/video files referred to in the library are resolvable from ALL locations, so they must also be on a network share.
    – Use Automount Maker, or some other solution, to ensure that your NAS is mounted every time each computer boots up (you’ll need to manually ensure that your MacBook Pro mounts the share, obviously, when it travels back into your network)
    Under this scenario, changes made in each iTunes library will be reflected in all machines running iTunes off that library. HOWEVER, the critical caveat is that only one computer can have iTunes running at a time.
    This was a deal breaker for me, since I wanted to have different instances of iTunes running in each room. It appears that iTunes locks the library on startup (or probably on the first edit — including accumulating playcounts) and other instances of iTunes won’t be able to work against a locked library.
    Solution B:
    If you can’t live with the above solution because, your next best bet is rsync.
    I have searched high and low, and have not found sufficient information online to properly configure a two-way rsync. But the way it should work, if you can figure out the right switches to apply, is that it compares two folders — even over a network — and merges all changes between them. Meaning you can edit your iTunes library in both places, and on the next rsync they will be synchronized.
    You’ll likely want to schedule rsync to run at night, either as a cron job, or through an AppleScript, scheduled with iCal. The advantage I’ve found to a nightly AppleScript is that I can automate other maintenance tasks nightly.
    rsync is a part of the OS X distro, but apparently the version Apple included has some problems. You should be able to find info about rsync_hfs online, or you could try out the RSyncX GUI — which is only marginally less difficult to understand.
    At this point, I have to shut-up, because I’m out of expertise. I would be very interested in hearing from you if you find a solution, or if you get rsync working. Its a very powerful command line tool, loved by many geeks. But unfortunately information about its two-way sync capability seems to be sparse and difficult to understand.
    Please let us know if you make any progress on this — I wish Apple would come up with a simple and elegant way to do this for us!

  2. …thanks a lot for the info. 🙂
    After looking around, I just went with two 500gb mybooks, one of them as the time machine backup, and one of them as the file repository. these are both usb connected to the mac mini, which will be up and running about 98% of the time…so, eventually, i’ll set up some way to access this from the web, via a secure http connection of some sort. i’ve already installed the ultra-geek-cool tomato, and have linked it to a dyndns account, so i’ve got an address to go to once i get it set up (as my ip changes every once in a while from the cable company, that’s my best bet).
    Two cheapo usb drives (i got them as refurbs from ecost for $99 each) were a lot more cost effective than any nas i could think of, and once I factored in time machine, i wasn’t too worried about having raid.
    so, as I mentioned, i played with rsyncx for about 15 minutes, and it was confusing as hell. not to mention that when i *could* get it to sync, it would only do so when i entered the password…couldn’t figure out a way to just whisk it on its way w/o having to enter password every time.
    another problem was that this is syncing to a laptop (obviously, but bear with me)…at night, i want to close my laptop, thereby making it impossible to sync from/to.
    the best option that I could think of would be to somehow have a trigger that would sync to/from the laptop whenever it is detected on the network. I’m sure that can be done, with a nice bit of scripting, but I’m certainly not going to be the one who can do that.
    At this point, what I decided to do was (and this is a bit convoluted):
    store all of the mp3’s on the external drive, connected to the mini. have a library file, on the mbp, that looks at those mp3’s, but the library is stored on the library. on the mac mini, have it look at the library file on the MBP (option-click when opening itunes on the mini…i know you know that, but i’m saying it for posterity).
    why the hell did i do it that way? well, if i leave the house, and ever want to sync the ipod, the mbp will be with me. I don’t need to have the actual mp3 *files* on the mbp, but the library file must be accessible from the mbp, or else i wouldn’t be able to sync/download new podcasts/etc.
    In that vein, I have decided to keep the iphoto library on the mbp, so when i plug in the good ol’ nikon d40 whilst on vacation, it will sync to the mbp’s iphoto library…as apple has made the iphoto library a package, i don’t want to deal with figuring out how to consolidate two libraries, so i can’t exactly set it up to work exactly like the itunes does…oh well, the mbp is still time machining to the drives connected to the mac mini…so if it dies completely, i’ll still have the photos at home.
    I really think that rsyncx will be the thing that will work best for me…being able to update with the latest file will be nice…i’ll play with the symlink…thanks for the info.
    oh, your link to ‘automount maker’ is busted…
    keep it real, man….:) thanks again for the input…I’ll be back to expound if i figure out anything new.

  3. That all sounds like it should work fine. The only thing I might suggest is that if you use Symlinks you’ll never have to “tell” iTunes to open a different Library, since the Symlink will just point is straight there.
    This works exceptionally well with the iPhoto Library. We easily shared and edited the same iPhoto Library from two different computers using a Symlink. Neither computer actually had the Library local, either. Both had Symlinks pointing to the Library on a local share. Worked like a charm, as long as you don’t both try to edit the Library at once.
    PS: Fixed that link, thx.
    PPS: Don’t you just hate rsync?!

  4. …one thing I think I noticed with symlinks: if you have, hypothetically, an external drive with a bunch of movies saved on it, and a symlink to that external drive in your ‘movies’ folder (so you can see it in frontrow), I believe that time machine will perform a ‘double backup’ of the files. once from the symlink, and once from the external.
    I’m trying to figure out how in the hell my 80gb mbp and 80gb mac mini w/ 100gb of information on an external drive have managed to completely fill a 500gb external usb drive. I’m thinking there was some strangeness with things getting backed up from multiple places.
    And…i’m not worried about having to ‘tell’ itunes where the library file is…were you talking about my ‘option-click’? You’ve only got to do that once…once itunes is looking at the library, it’s there…of course, a symlink will work, but so does this way…

  5. I just went back to Leopard, and although I have no interest in Time Machine, I did notice that you can exclude individual folders/drives from its back-up process. That might save you some space!
    I wasn’t aware that you could permanently “switch” iTunes Library using option-click. Thanks for the tip!

  6. …yeah, the confusing thing is figuring out how in the heck i ended up with so much data saved by TM in the first place. 🙂 my mac mini backup is 300gb….very strange.
    I’m deleting all of the backups now, and starting over…hopefully have this thing humming today. 🙂

  7. …and, the answer is, from wikipedia (just posting here in case anyone else has the same issue:

    Due to Apple’s continuation of the HFS+ file system, Time Machine does not support block-level backups. If even one entry in a large data file changes, the entire new version of the large file must be backed up. Other backup solutions will simply back up the portion of the file that has changed. This missing feature has raised serious concerns; the main reason is because Macintosh users sometimes make use of virtualization; virtual disk images are very large and change every time they are booted, making it essentially impractical to include these disk images in Time Machine backups. Another reason for the concern is because some developers continue to use single database files to store data — a common example here would be Microsoft’s Entourage, which stores all email messages in a single file.

    Wikipedia Time Machine Article.

Leave a Reply

Your email address will not be published. Required fields are marked *