Amazon.com Widgets
Twitter » Linkedin » Flickr » DjangoPeople » Feed
...not so private reflections of greg.newman
RSS feed - Categories & Search

How To Share Your iTunes Library With Multiple Macs And An NAS

I recently aquired a refurbed MacBook for my wife. She also owns a 30 gig iPod for her workouts. In addition, she's a spin instructor and has a constant need to burn CD's for her classes. I've always kept our music library of 70 gigs on a portable hard-drive connected via USB to my MacBook Pro; when required. Since my lovely wife is not as macnerdy as me, it's been a drag on her to access the music library. If she needed to update the ipod she obviously used my mac.

Now I've updated our network to accommodate her needs. Here's how we are sharing the music library and how I did the updates to the existing setup.

Essential Hardware

I picked up a 350 gig NAS which is formatted as fat32. I kept that as the format in case any shmuck (Jim) wants to access it with a PC.

Library Update

With the NAS connected to the wireless router, I hooked up the 120 gig external that housed the library for the last 3 years and copied everything over to the new drive.

I renamed iTunes Library and iTunes Music Library.xml located in ~/music/itunes to old and opened iTunes on my MBP. This gave me a clean slate to work with; a blank library.

Next, I changed iTunes preferences to point to the network drive for the storage location. There's a few steps I'll discuss later to help assure the drive is mounted all the time.

With the preferences changed, I chose "add to library" and pointed to the new drive's library and walked away for about 2 hours for it to update the 11k songs (1200 cd's) on the drive. It actually took almost a full day for iTunes to determine the gapless play and update the artwork library.

Problems when you sleep

One problem presented itself almost immediately and made me realize my wife would have bigger issues with her Macbook. It would just be a pain-in-the-ass for me -- when I close my MBP (sleep), obviously the network drive connection dropped.

To get around this I setup a automator script that would mount the drive for me on startup. In automator, drag over "Get specified servers". Click the plus to add a server, choosing the network drive. Drag over "connect to server" and then save it as an application to your desktop or somewhere safe. To automagically mount this when you startup the computer, open your system prefs and drag the application you just made to your login items (located in system/accounts). Now when I startup the mac, the drive is ready for use.

That still didn't fix my sleep problems. So I downloaded Sleepwatcher and installed both scripts. With Textmate I created a file in my home directory named .wakeup and added in the following.

#!/bin/sh

#Wake 10 seconds before connecting to the network drive

echo 'sleep 10

logger -t sleepwatcher "connecting to the network drive"

open ~/Desktop/connect_to_server.app' | /bin/sh&

Sleep is set to 10 to allow for the lag in the network on startup. With this script and sleepwatcher, I am now sure that my network drive is always mounted and ready for use. Cool thing is you can add anything you want done on wake to that script to save you some time.

Setting up the wife's Mac

I fired up the wife's Macbook and installed sleepwatcher for her computer, copied over the automator script I created earlier and the .wakeup script, and added the automator to her login items. Now I know she never has to mount the network drive.

I copied over the two files, iTunes Library and iTunes Music Library.xml located in ~/music/itunes, which were recreated when I rebuilt the music library earlier on my MBP to the wife's macbook, letting them overwrite the files that were on her mac.

A Happy Wife

I fired up her iTunes and instantly saw our library on our network. She's now able to access all music, burn cd's and update her ipod from her mac as am I. So far, I'm not getting any conflicts with this setup at all.

A Probable Flaw in the Setup

The only foreseeable problem could be with purchasing new music from the iTunes store and/or adding new cd's to the library from a rip. If I purchase a song or CD, I more than likely won't be seen on the wifes computer, so what I plan on doing is symlinking the ~/music/itunes folders on both macs to one folder on the network drive. I haven't tested it, but in theory, it should solve that issue. If not, there is software available that will sync the two libraries. I'll update this post when I cross that bridge later this week.




Update

I changed the wording in this narrative. The .wake script should be named .wakeup unless you edit your rc.wakeup file located in etc/ to reflect a different name. Also, very important, you must have execute permissions set for the .wakeup script to work properly.

0 TrackBacks

Listed below are links to blogs that reference this entry: How To Share Your iTunes Library With Multiple Macs And An NAS.

TrackBack URL for this entry: http://www.20seven.org/cgi-bin/mt/mt-tb.cgi/45

34 Comments

Hey- this is great. I plan to buy an NAS this weekend to implement it for me and the wifey. :)

How about for your iPhoto library? Can this solution work with that as well?

Since iPhoto uses a similar method for file storage, I'd say yes, it probably will. I don't use iPhoto except for getting around Aperture's printing bugs. Aperture lets you specify a directory, so it's a no-brainer with it.

A few quick questions since this topic is SO relevant for me.

Last night I hooked up a 500gb drive to the new Airport Extreme and put it on my network. I have a similar iTunes library that I want to share with my wife (MacBook Pro & MacBook) respectively.

I am not sure about the drive and if it unmounts after sleep (installed last night and rushed out to work this a.m.). Can you expalin why you need Sleepwatcher? It would seem liek the automator script would do the trick or is this only on restart?

Secondly, do you know which software will sync the library and xml folders on both Macs? Perhaps there is software that will work with .Mac as well.

Lastly, what are my (and yours) for that matter options for starting iTunes holding down the option key and pointing to a Library. Can there be a "local" iTunes folder with lets say podcasts and music to fit on a Nano as well as having another Library that has the "jumbo" music collection on the NAS?


You thoughts appreciated and thanks for this great post!!!!

Jerry,

The sleepwatcher is used to re-mount the drive when your laptop goes to sleep. I don't know why it drops the connection, *but it will*. The automator sciprt/app is only for bootup of your mac and for the sleepwatcher to remount the drive.

As far as your second two questions, I think this article: http://www.macosxhints.com/article.php?story=20070203085555284 might do the trick. I'm planning on running some tests with Chronosync to see how it works this weekend. I personally would prefer symlinks or sync software instead of telling itunes where to look.

Let me know how all this works for you Jerry!

Why would you care what the filesystem is formatted as if it's a NAS? As long as the NAS supports the FS, it's fine other than some oddness because e.g. Windows can't deal with a lot of characters in a file name like colons.

You're not exporting the FS details over the network, it's a network FS that the clients are accessing. FAT32 is a truly awful filesystem compared to most other alternatives.

Also, your network drive is dropping on sleep because you're accessing a CIFS (SMB) share. If the NAS supports NFS or AFP over TCP sharing it will be there when the Mac wakes up. This might suck with a notebook, I only have a desktop Mac.

Good points Bill. I didn’t dig into my NAS too far, but from what I read in LaCie’s docs, and from what I was told, if I formated the drive for mac, it supposedly for some reason becomes read-only and won’t allow my macs to write to it. The documentation sucks from LaCie. All it says is that it has to stay fat32 to be writeable. It doesn’t really bother me, seems fast enough and haven’t had any issues so far.

I am curious to see what happens at the end of the month. I ordered an Apple TV and not sure what effect that will have on the setup.

Then it sounds like the NAS only supports FAT32, not HFS or ext2/3 or something like that. Actually, HFS+ would be kind of surprising.

This is part of the reason I'm sticking with an Ubuntu server on a low power CPU for my network drives rather than making the jump to NAS. There's decent filesystem support, decent network fs support, and no problem adding USB drives. However, I'm sure it is slightly louder. It's still quieter than my WD 40GB drive in an external enclosure...

This thing does have a little hum to it, but not bad. I had thought about using Suse or FC4 for it, but that computer is always hogged by my son playing online games (in windows).

Here is what LaCie says on their site and in the docs:

*Warning about formatting:*
LaCie Ethernet Disk mini is pre-formatted as FAT 32 volume and can be used across multiple platforms (for example, Windows 2000, Windows XP, and Mac OS X).

It is not recommended to reformat the LaCie Ethernet Disk mini inNTFS as it will invalidate write access to the drive, and it will be impossible to store files on.

If you ask me, that's dumb-as-hell. But I didn't want to take the chance.

It appears that with new Airport Disk Utility installed, both a MacBook and Pro models wake from sleep or start and automatically discover the NAS drive. I did not have to create an Automator action.

Additionally, if I use the option key when starting iTunes and point my wifes MacBook to the NAS drive with the iTunes folder (music and library files in same location), everything works fine.

Any thoughts?

JerryZ...
I have the new Disk utility installed and it's not working properly all the time. Sometimes the disc was available after sleep, sometimes it wasn't. If yours is always there, you're lucky.

When you use the multiple library feature, are the songs available on other Macs, or do you have to add them to your library from each mac?

I'll need to check on the multiple library and adding tracks.

Since we are both using MacBook & MacBook Pro, it's strange that mine works and yours doesn't. Did you add the new software to both computers? (dumb question. I am sure you did.)

Yes, I did add it. I 'try' to keep things up to date. Now maybe it's because of what BillS states up above about using CIFS or maybe it is the software. Not sure yet. When I find out, i'll add in an update.

I spoke with a tech from Apple who isisted that FAT32 was the way to go (this is what my disk is formated in).

As an aside, SuperDuper will not work with a NAS FAT32 disk.

Very interesting. I would never have guessed they would recommend fat32.

I noticed SuperDuper won't work either. Bummer.

I bought an external harddrive so that I could listen to my music on two different computers. Your solution for sharing a library on both computers seems like it would work—But only if both computers are macs.

I run Windows XP on my 20" iMac, and would like to be able to listen to my music on both operating systems, however if I add a song under OSX, iTunes on windows wont see it. I tried messing with the library and XML file a while back, but I seem to remember the windows version of iTunes uses a different type of library file, and doesn't understand Mac aliases.

Any input would be appreciated. Thanks~

Ben,
While I have a PC around, I don't have it setup on my network for sharing. Have you tried holding ctrl key when opening iTunes? I haven't used it but you should be able to point your pc to the library using that trick. It might have to reindex the library on your PC doing that; not entirely sure. Keeping the libraries synced across mac and pc might be a bigger issue.

Let me know how you make out.

Holding control while starting iTunes in windows doesn't seem to do anything. I did have a question though, If the XML file stores the song info and stuff, what does the "library" store?

I think the way I originally set up itunes on window was by importing the XML file from iTunes on my mac. If that's the only part I need, I could just overwrite the file whenever I update on the other OS. I could probably find/make an applescript that compares the two file's dates and overwrites the older, if my windows partition were formatted FAT32(It's NTFS).

Until someone comes up with a more commercial solution, I don't think I'll be buying much music. Anyway, thanks for the quick response.

I've personally never tried the muliti-library feature Ben, and it's been a LONG time since I used iTunes on Windows. Have you compared the two xml files? You could backup the file on windows and replace it with the mac version and see what happens. If your library resides on Fat32 partition, you shouldn't have any issues, theoretically, but again, I don't use windows much anymore.

I will be updating this article soon with more information on syncing. I'm waiting for my Apple TV to arrive next week or the following to see what kinks that puts in my setup first. I want that to be the main hub and need to see how it handles the library first.

The two XML files both show up as 4MB, adding new songs wouldn't make much of a difference because characters don't take much storage time. For now I've just been replacing the other OS's XML file if I do any file-changing (If I remember), and that seems to work. If iTunes could use an external library file it wouldn't be a problem. But unfortunately, that's less likely than them adding windows support for the Front Row remote.

Greg

What you mean by "Also, very important, you must have execute permissions set for the .wakeup script to work properly". How to set the execute permission for .wakeup?

And if I don't have Textmate, any other editor can be used to creat the.wakeup file?

Thanks.

Vincent,
You can use any text editor, just make sure you save it as '.wakeup' which you will probably get a prompt asking you to confirm the naming.

Open up terminal and navigate to the directory the script was saved to. If you're not a terminal guy the command is


cd directoryname

Once there, just use chmod like this

chmod a+rwx .wakeup

Can I follow these steps to create a path to my pc too? I just got a 500gb pc, threw all my music on there with the hopes to free up space on my macbook, but I still don't see my music in itunes through my network.

Dunno if somebody mentioned that here but if you mount the server and drag n drop it into the startup items on your account in the system prefs it will mount automatically at system start.

Just figured out that if I try to do the auto connect with automator my folder will not get mounted. The adress is smb://cube/outta%20space and I think the %20 stopps the automator to run. Even the cifs adress is not working. Funny

Greg,

You'll probably find that the reason the NAS is R/W with FAT32 but only RO with NTFS is because the LaCie NAS runs Linux.
You don't say which LaCie NAS you use but taking the Ethernet disk mini as an example it runs Linux and also lets you connect it directly to the PC as an external USB drive.
When it is connected as an external USB drive you can format it with the filesystem you like because it the PC that is reading the filesytem. So you certainly can format it NTFS on a PC and use it RW.
However, when you change to accessing the NAS over the LAN your PC uses SMB/CIFS to mount it as a network drive. At the other end LInux is serving up the network drive to your PC and it is Linux that must read the filesystem. If the drive is formatted one of the common filesystems that Linux supports (and for the LaCie NAS this is FAT32 and EXT3) then the network share will be RW to you PC. NTFS has only been supported RO by Linux which is why it can only be served up RO by the NAS to your network share.

Hello All,

I've used your method to share my single iTunes library on two macs (MacBook Pro running Leopard and a PowerMac G4 Cube running Tiger). The Cube is acting as the server, storing all the music as well as the iTunes database file on its internal drive. All I've done is specify (through a mounted network drive on the MBP) the iTunes database file on both systems and everything is a go. I didnt have to mess with the '.wakeup' fix as you suggested, there doesn't seem to be a problem when I put my MBP to sleep as of yet, do you think this issue of re-mounting network drives upon wake has been fixed in Leopard?

Thanks,
Alan

Hi Alan.
I've been watching it on my MBP with leopard. I have only had to manually connect to the server once or twice in a couple of weeks and I'm not so sure that it was my MBP that caused it to not wake up. I think Leopard might have fixed this. All other macs on the network automagically show up in my servers list too.

Whatever was the solution for keeping both libraries up to date?

Thanks!

Why use automator?

instead enter this into .wakeup script and skip the automator part, this is easier and faster.

Use the command mount_afp for "apple file protocol" disks, if you have samba (windows drives) use mount_smbfs instead.

change user, pass, server and share1,2,... to the names you have on your network.

#-----

#!/bin/sh
#Wake 10 seconds before connecting to the network drive

echo 'sleep 10

logger -t sleepwatcher "connecting to the network drive"

mkdir /Volumes/Share1
mount_afp afp://user:pass@server/Share1 /Volumes/Share1

mkdir /Volumes/Share2
mount_afp afp://user:pass@server/Share2 /Volumes/Share2

#------

Are you both able to have iTunes open at the same time?

Have you figured out a good way to add music to the library?

One thing to watch out for is the location of "non iTunes Store" music & videos i.e. items added by "Add file..." or "Add folder..." to library. iTunes stores a pointer to the file, not a copy of the file (which would waste storage by duplication) and therefore moving the iTunes folders to a new location (whether on a netdrive or not) will break all those items in the iTunes library. It is essential that the .MP3 files are also moved and stored in an identical structure to that used when iTunes was pointed to the local disk.

I have a NAS connected to a netgear w-router. My PC is wired to the router but my MacBook is not.
The MacBook running itunes or opening files from the NAS is extremely slow, painful.
Is any tweak out there to make the data transfer more smooth?

Thanks,

Juan . ///

Leave a comment