I have an unRAID server (If you're unfamiliar with unRAID, you can check it out at lime-technology.com) which is a Linux based server. I'm getting terrible performance with iTunes on my iMac. The music playback is fine. But if I import a song file or change any metadata, it has problems. This isn't new, I've read many, many posts complaining about this and other problems concerning SMB shares and file systems. But I think I may be onto something and would like some advice.

This is what I've found so far. Snow Leopard, OS 10.6.x, has a problem with SMB and/or any file system other than HFS+. HFS+ is the common files system for OS X.

There are hundreds of posts on the web complaining about temporary freezes, slowdowns, sometimes crashes on the Mac using SMB shares and other file systems. I have yet to see Apple acknowledge that there is a problem, but there are a few suggestions out there that seem to have helped people. I'll be trying out some of these this week and post the results here.

From my own observations, specifically with iTunes, I've noticed some strange behavior. Here's my setup. I have an iMac running 10.6.4 (the latest update), the latest iTunes 10. The iTunes app is located on the local internal HD, I have my iTunes library files and all my media on disk 1 of my unRAID server. I'm hard wired to the server via a gigabit router. I have iTunes set to keep the media organized and copy the media files to the server.

When importing a song file into iTunes, the file initially seems to copy at a good rate, the file appears in it's proper place and you can see the size increasing as it copies. Then it stalls for a while, then the name changes to a long hex number for a few seconds and then reverts back to its' normal state. The process can take 30-40 seconds, even with a small song file. I looked at the console and I got the following error message:

This happens for each file imported or changed even within iTunes. It doesn't seem to matter if the source file is on the Mac (for import from, let's say) or the server (for metadata changes, let's say)

I followed the first path in the error message: /Applications/iTunes.app/Contents/MacOS/iTunes[2820].

In the /Applications/iTunes.app/Contents/MacOS/ folder I find the following files:

iTunes

libgnsdk_musicid.1.7.1.dylib

libgnsdk_sdkmanager.1.7.1.dylib

libgnsdk_submit.1.7.1.dylib

where iTunes is a Unix Executable File.

I did some more research and have found some posts about file systems other than HFS+ having trouble with app packages. I believe that all OS X apps are actually packages, like folders, but appearing as a single file. Other file systems don't seem to know what to do with these. There was some talk of "flattening" these app packages, but I haven't gone forward with that yet because I'm not sure I understand it enough yet.

I've also noticed that in the getinfo box under sharing & permissions I usually get "You can read and write", but with apps I get "You have custom access". This was something i had noticed before and thought it was a problem on the server, but I didn't realize it until now, I'm getting the custom access on every app. So I think that's probably normal.

I'm wondering if I'm having a permissions problem with the iTunes Unix Executable File. Right now the permissions are set as follows:

system: Read & Write

admin: Read & Write

everyone: Read only

Maybe it's trying to write to that file or another one and doesn't have the right permissions since the song file is now on the server and that's causing the stalls? I'm over my head here. Anyone have any ideas?

3 Answers
3

What physical (network) hardware connects the unRAID server and the Mac?

How long are any cables?

Are your network cables old/damaged/kinked at all?

Are you using a wireless network?

What's the ping time between the unRAID server and the mac?

Can you run a long term ping between (ideally with large packet sizes) and see how the response time varies and whether there's any packets lost?

It sounds like it might be a case of high latency or packet loss in the file system access causing issues. If so, then an unreliable network might be a simple thing to fix... but we'll need a bit more info from you about your setup to know if this is the issue.

High ping times (more than a couple of milliseconds) will really slow down access to lots of files (which iTunes will be doing when syncing for example). Packet loss will be even worse, as it might mean a stall for well over a second while attempting to access a file.

SMB Software

Are you able to test a similar setup using a Windows or Mac machine instead of the unRAID server (perhaps with reduced total library size)?

Are you able to compile your own version of samba on your Mac (ideally the same version that your unRAID server uses) and mount using that instead of the built-in samba client? (this one I have no idea how to do, but I'm fairly sure would be possible for an experienced UNIX sysadmin/hacker).

By swapping out the unRAID samba server or the built-in OS X SMB client entirely, you may find that it performs equally badly or "just works"... There's every chance that the unRAID server and Mac OS X 10.6.x just don't talk SMB very well together, in which case testing it with a different SMB client/server combination may show improved performance.

It's hard to assign fault if that turns out to be the case, because it could be either the client or server end that are technically not doing the right thing, but it's at least something to test... you might be able to permanently change the server or client SMB software on one machine to solve the problem...

iTunes Software

Can you test this out on an old version of iTunes? (would require rebuilding the library for that version of course)

If you have access to a machine with an older version of iTunes, you could see if it performs any better... perhaps its just that iTunes can't handle the network-induced lag (which may be at its maximum performance based on your network & SMB server-client setup).

Hopefully you have access to some other computer(s) and/or network hardware to do some of these tests, which should shed light on the underlying cause. Even if its a bug at the high level (with iTunes or unRAID or OS X), it may be something you can mitigate by providing a better (faster? more reliable?) network connection between the two computers. In any case, that should give you somewhere to start, and some more information for us to help...

The physical hardware is the imac to an Asus GX-D1081 gigabit switch to the server which has an Asus P5N-MX Moto, Pentium dual core E2180 CPU, 2GB DDR2 RAM, Netgear GA311 Gigabit Ethernet PCI Adapter. I'm using new CAT6 ethernet cables. The cable to the server is 50ft. That's the longest one. The pings range from approx. 0.05ms to 0.60ms, averaging in the 0.2's & 0.3's, so I don't think that's a problem, is it? I'll try creating an alternate iTunes media folder on a Windows and see what happens, good idea. I've heard about compiling my own version of Samba, I'll have to check into that
–
abernardiNov 11 '10 at 8:06

Concerning iTunes: I first noticed this problem when I upgraded to iTunes 10 from 9.2.1. It might have been there previously and I just didn't notice it, but I don't think so. My first action was to roll it back to 9.2.1, but the problem still persisted, so I went back to 10. Though, I do have an external FW drive with OS 10.4 and an older iTunes, I'll boot that up and see what happens. Thanks for the very helpful feedback!
–
abernardiNov 11 '10 at 8:11

Oh, and the unRAID is based on a SLACKWARE Linux system. I don't know much about it.
–
abernardiNov 11 '10 at 8:17

Okay, so sounds like network isn't the issue... could be that the iTunes samba client was changed slightly around the same time as you upgraded to iTunes 10? This is a total guess though, but perhaps check what other updates you installed at about the same time?
–
drfrogsplatNov 12 '10 at 3:14

Drfrog, I gave up trying to make it work. I'm using the unRAID now, just as a backup and using my old backup as the main media drive. That's a USB ext. drive and has no problems. THANKS for the help!
–
abernardiNov 13 '10 at 6:46

There’s something I don’t understand, if you have iTunes on a Mac (OS X 10.6), what does the fact that iTunes is a Package (like mostly every other Cocoa/Mac Application) has to do with the library problems?

iTunes is stored in /Applications, and as such it requires custom permissions so every user on the computer can have the proper access to it. Basically the “system” is the only one with read/write permission. Other applications may have other permissions, but as long as you have read, there shouldn’t be problems with that.

I’m not 100% sure about issues with iTunes storing a library in a smb share but there could be issues, not because Apple has (or has not) problems with SMB shares (the code is the same for linux/mac or any other samba client), but because samba (and the Microsoft protocol in general) is really not very good. iTunes may be having problems updating the metadata for the files (when it imports them) and that could be causing problems.

You don’t seem to mention what file system is your raid using, because SMB is not a filesystem but a sharing protocol.

I wasn't aware that Cocoa/Mac apps were packages, so that was kind of a tangent. However, I did read somewhere that other file systems don't know what to do with these packages because they appear to be one file and that can confuse things. I also didn't understand what the meaning of custom permissions were, so thanks for clearing that up. I think you're definitely onto something about the metadata problem being the real problem and not the importing. The file system on the unRAID server is reiserfs. I don't know much about it except it's a journaled file system. Great feedback, thanks.
–
abernardiNov 11 '10 at 8:23

@aber Np :) Yes, most Mac apps are packages, which are Folders that Finder happily hides from the user (you can “right click” and “show package contents”).iTunes library is composed of two things: 1) a Library.xml file and the media files itself. If the media is stored in a non-hfs+ filesystem, iTunes may have troubles updating the metadata it stores on each file when it imports a music track (for example). For the sake of testing you might want to find out how to start iTunes with an empty library and try using it locally to see if the prob. persists. Ask if in doubt.
–
Martín MarconciniNov 11 '10 at 20:48

Martin, from what I've found out, you're right. I never could get the metadata to update at a decent speed. So now I'm storing my iTunes & iPhoto on the external drive that I was using as the backup and using the unRAID as the backup. Probably should have done that in the first place.
–
abernardiNov 13 '10 at 6:44