Saturday, August 18, 2007

iTunes and remote media via NFS, not SAMBA

Strange that I haven't posted for months ... and that one was about iTunes as well.

Anyway, I've been cursing iTunes for months. I have over 5000 songs in my home library (for the record, almost all ripped by me, a few from artists who supply downloads, links below), and rather than copy them to all the machines in my house and try to keep them all sync'd, I store them all on a terabyte+ RAID server on a linux box. The filesystem is exported through SAMBA and mounted into each of the Windows machines around the house.  Hey, it works.

But it hasn't worked well for a few reasons. One is that it is SLOWWWWWW! It took me ages to figure that it was Samba that was causing, or at least triggering, the problem.  It seems as if iTunes needs to read the files when just scrolling the file list in the iTunes library, which is quite insane.  But what I would see is I'd drag the scrollbar and a full second or more later the window would actually scroll. Ditto if I click for page down or something. It was desperately annoying. And going through SAMBA to read these files, well, it wasn't pretty.

So today I bit the bullet and figured out how to install MS' NFS Client for Windows, and I remounted the linux filesystem through NFS. This is a huge improvement. While still slower that local, the action is almost live now.

Of course, the real culprit is a broken design for iTunes.  Whether single-threaded, or just reading the files when it doesn't need to, simply scrolling the window shouldn't do anything but scroll information already present, either in memory or at worst already in the library file which *is* local.

For those with similar problem, here's how I did it.
  1. stop iTunes 
  2. Download Windows Services for Unix direct from MS
  3. unzip into a local directory (just click the exe in explorer)
  4. install in a cmd window per these instructions 
  5. reboot - the mount command used below wasn't found until rebooting
  6. unmount the samba drive
  7. remount from the command line. I used: mount -o rsize=8 -o wsize=8 -o anon -o nolock \\server\media m:
  8. move the itunes directory under My Documents | My Music to another name. You can delete it later.
  9. start iTunes. In Advanced settings, I set the location of my itunes folder to the remote media folder (in my case, M:\mp3). Make sure "Copy files to iTunes folder" is cleared. The reason I set the library to M:\mp3, rather than keep the library local, is so when I rip more albums they are automatically saved on the server.
  10. File | Add Folder and pick the remote media folder.
  11. go have a beer or two while all the files are indexed, volume and gapless checks are done, etc
That's all it took, and now iTues is almost as responsive as I would like on Windows with all media files remote.

Enjoy.

I promised links to some artists who supply downloads of their music. Here are a couple:
  • Children of the CPU supply mp3s of all tracks on their album for download here  
  • SXSW'07, there is a torrent of 739 tracks on this page
  • I love Milla Jojovich, and her site usually has some tracks available, usually demos.