View Full Version : My iTunes + Slimserver wrong file count problem found &solved

2005-03-16, 12:34
To save others from pulling out their hair, I thought I would share
this in case you have a similar situation.

First of all, I have a pretty unusual setup:

Slimserver 6.0b1 running on a Linux box with a raid card. Two 250gb
hard drives in a raid0 mirror shared out to the network via samba

iTunes running on a Mac. The local ~usr/Music/iTunes folder is
actually a symbolic link pointing to the raid drives so my iTunes
database is mirrored as well.

When iTunes launches it pulls all the data from the raid drive mounted
via samba. It's been working ok until recently. Not sure if it was a
slimserver change, or more likely a change in my setup. Recently, the
slimserver started reporting that it found only about 2,000 of my
27,000 mp3 files. No matter what I tried, it could not see more than
that. I wiped the cache file, wiped the server setup. Hell, I even
backed up my iTunes folder & created a new database with only 199
songs. It still had the problem of only finding a portion and would
report "file not found" if I used debug options.

As I was doing more tests this morning, I discovered a very curious bug
with iTunes when it saves it's data to a linux drive upon the program
quitting. Essentially the date stamp on the file gets all screwed up.
After about 15 seconds of itunes quitting, I noticed that the date
stamp for the following files went from this:

-rwxr--r-- 1 healy healy 42207161 Mar 16 06:57 iTunes 4 Music
-rwxr--r-- 1 healy healy 39349573 Mar 16 06:57 iTunes Music

To this:

-rwxr--r-- 1 healy healy 42206857 Mar 16 2005 iTunes 4 Music
-rwxr--r-- 1 healy healy 39349255 Mar 16 2005 iTunes Music

For some reason, it turns from a time stamp to a year stamp. I started
& quit iTunes multiple times & confirmed this happens each time it
saves it's data to the raid drive. When the slimserver attempts to read
the data when it's in the year stamp format, it gives me the incorrect
file count & reports file not found on 98% of the files. If I change
the data stamp, the slimserver finds all the files just fine.

I ended up writing a little cron job to do a recursive copy of the
iTunes folder into a second location that is only used by the
slimserver. I thought about using rsync but it preserves the dates so
that was not an option.

Anyways, I _think_ I've finally figured out this really obscure bug
with iTunes writing to a linux drive mounted via samba. I thought I'd
share in case someone out there is doing something like this.