Viewing By Category : iTunes / Main
December 28, 2007

This morning when I hopped on my home desktop machine, I was greeted with a nice iTunes error message telling me that my iPod was trying to sync with a library other than the one it was registered with. Huh?? A quick look at iTunes revealed the problem - it was completely blank! No songs, no podcasts, nothing. That's odd, because I have close to 30k songs I've ripped. I had a good idea what was wrong (but not how/why it happened). A quick look in my "My Documents\My Music\iTunes" directory revealed the problem. Both my "iTunes Music Library.xml" and my "iTunes Library.itl" file were only a few bytes each - when each of them should have been close to 50MB.

To make matters worse, I'm obsessed with meta-data. I have all of the album art and ID3 data for every single song - which is OK because the album art is stored in the directory for each album, and most of the meta-data is in the ID3 tags. BUT, because iTunes insists on using ratings outside of the ID3 tag format, all of the rating information I had accumulated (and associated smart playlists) was gone.

To top things off, I hadn't bothered to make a backup of my iTunes Library XML file lately because I'm running low on storage space. No excuse, I know.

Luckily, while I was looking in the iTunes directory, I noticed a sub-directory called "Previous iTunes Libraries". Inside that dicrectory were several copies of my "iTunes Library.itl" file. The most current one was about three months old - probably the last time I upgraded iTunes. Best case scenario I was looking at here was getting my library back, minus about three months worth of meta-data.

Getting iTunes to use the old .itl file was easy:

  1. Close iTuned
  2. Delete the blank/corrupted "iTunes Music Library.xml" and "iTunes Library.itl" files from "My Documents\My Music\iTunes"
  3. Copy the backup "iTunes Library.itl" file from the "Previous iTunes Libraries" directory to "My Documents\My Music\iTunes"
  4. Open iTunes - all of your music and meta-data up to the point of the backup file will be back.
  5. You'll need to add any music that you've gotten since the update. For me, that was easy. I just choose Add Music from Folder from the iTunes menu and chose the root directory where all of my music is stored. In about 10 minutes, iTunes had added all of the missing songs back to my library

There you have it. Relatively easy way to recover a deleted or corrupted iTunes library. Now if only I knew why iTunes decided to wipe it out in the first place.

April 22, 2005

I recently ran out of room on my internal 160 GB harddrive, mainly due to my mp3 collection. All told, I have over 100 GB of music, and I buy more all the time. Couple that with video and my digital pictures, and I'm totally out of space. To solve the problem, I decided to add another harddrive. I was hoping to go with NAS, but after looking around, I didn't really find anything that offered a decent enough price/storage ratio. In the end, I added another internal drive. I went with a Seagate 250 MB SATA drive to match the 160 GB drive I already have. I chose Seagate because they are the only company offering a 5 year warranty. Earlier this year, I had two harddrives go within a month of each other. One was 4 years old, and the other 3.

I run Windows XP at home, and store all of my music/pictures/videos in shared folders as both my wife and I have our own iPods. The way I have it all configured, we have our own iTunes XML library files so that we can have our own song ratings, play lists, stats, etc., but make use of the same library of songs from the shared folders. Since I was planning to move all of our media to the new drive, I knew I was going to have to make some changes to both Windows and iTunes to get it all configured correctly.

The first thing to create new folders on the new drive and get Windows to recognize them as my shared folders instead of the default shared folders located in C:\Documents and Settings\All Users\Documents. To do this, you need to make some registry changes. Please note that if you use TweakUI, it claims to be able to change the shared documents location, but it doesn't work. The only way I have found to do this is by directly modifying the registry. For specific instructions, see here. After following the instructions, I had my shared documents folder located at D:\Shared Documents. I put a My Music, My Pictures, and My Videos folder under Shared Documents.

The next step was to copy all 100 GB of my music collection from my C drive to the new location on the D drive. This took about 30 minutes or so to complete. One thing to note here. I don't let iTunes manage my music in terms of letting it take control of my files and folders. I tried this once when I first switched to iTunes and found that it basically sucks. iTunes may think it knows how to best organize your music collection, but it doesn't. I didn't like it's organization of naming conventions at all. I've always let iTunes keep it's library and xml file in my My Documents folder, but my actual music has always resided elsewhere.

You may be asking why I didn't simply blow away my iTunes xml and database files and re-import all of my music. If I did that, I would lose all of the rating information, play lists, etc. that I mentioned earlier. So, in order to get iTunes to recognize my music in the new shared folders location, I needed to tweak the iTunes XML file that points to each song. It took me quite a bit of trial and error to get this right last night. In the end, this is the procedure that worked:

  1. Close iTunes
  2. Before doing anything else, make a backup of your iTunes Music Library.xml and iTunes 4 Music Library.itl files. They are located in C:\Documents and Settings\user\My Documents\My Music\iTunes by default.
  3. Open the iTunes Music Library.xml file in Wordpad and do a search and replace for all occurrences of your current drive/directory location and replace with your new location. Note that directories are separated with a forward slash, and all spaces in directory names must be escaped as %20. Depending on the size of your XML file, this could take a while. Mine is 30 MB. I ran a few errands and found it had completed when I returned. Save the file when you are done.
  4. Now, you need to corrupt your current .itl database file. The easiest way to do this is to open it up in Wordpad and just delete the contents of the entire file, then save it. You should have a zero byte file.
  5. All that's left to do now is to open iTunes and let it rebuild your database. After it scans in all of your mp3's, ut will tell you that the .itl file is corrupt and ask if it's ok to rebuild it. Let it rebuild the database, and when it's all done, you are all set!




Copyright 1995-2008 Rob Brooks-Bilson. All rights reserved.
Aura skin for Raymond Camden's BlogCFC inspired by Joe Rinehart & Steven Erat. This blog is running version 5.5.1.