Friday evening saw the crash of my iTunes library (and me basically spending the weekend trying to recovery from it). I have been running iTunes since, well, there was iTunes (I started with OS X 10.0.0). This meant that I had 5+ years of play counts, ratings, playlists, etc built up that were basically lost in the crash.
I’m not even sure what caused the crash. I was listening to my iTunes library while ripping a new CD I had just purchased. The only out of the ordinary thing was that the Software Update dialog had popped up telling me about the new security update. About five seconds later, I was presented with a ‘iTunes has quit unexpectedly’ message. Then the fun began. I restarted iTunes, only to be told the my iTunes library was damaged and that the file was being renamed with ‘damaged’ appended to it. This seems a rather purposeless thing to do, because I have yet to find a tool that will allow you to recover your damaged library or even analyze it. However, the file it should have made a backup of is the ‘iTunes Music Library.xml’ file. It turns out that you can recover from a library crash if you have an intact copy of the .xml file.
Assuming that you have a good copy of the XML file, you can recover by moving the XML file to another directory, deleting the binary iTunes Library file and starting iTunes. You will notice that iTunes is empty — don’t panic, simply go to file, import and point it at your saved copy of the XML file. All of your play counts, ratings etc will be restored. IF you have a good copy of the XML file.
As luck would have it, my XML file (which was around 29MB), was replaced with a nice fresh one that was around 8K, so basically I was screwed. As I have about 100 GB of music (yes, it’s all legal, trying to find storage for all the CDs is a pain) I had a big task in front of me to recreate playlist and reassign music to the playlists.
You can bet that that the next thing that I did was setup an automatic process to make a copy of the precious iTunes Library XML file and tuck it in several safe places. What a great time to have the time machine feature that will be available in Leopard!
Oh, and Apple, you might consider having iTunes make its own backup copy of the XML file, especially when a crash is involved. Having a copy of the binary library file is useless for recovery, whereas the XML file is vital. Think about it.