After inserting an external hard drive yesterday, my iTunes library became corrupt. It apparently saw the external hard drive as the location of my music, something for which I indeed used the drive eons ago.
After disconnecting the drive I noticed that some newly added songs would not sync to my iPhone. I reconnected the external drive, checked the location of my music (which as I later found out is only updated after relaunching iTunes) and used the _File > Library > Consolidate _ . When I noticed that it was copying all my music to instead of from the external drive I canceled the process. And so I ended up with an iTunes library that thinks that my music is split between two disks even when all the music is still available in its original location.
I’ve quit iTunes and tried to fix iTunes library. iTunes keeps its music library in the file ~/Music/iTunes/iTunes Library and also exports it the XML file ~/Music/iTunes/iTunes Music Library.xml. iTunes directly uses ~/Music/iTunes/iTunes Library and will only reconstruct it from the XML file when this file is corrupt (if it’s simply deleted iTunes will start with an empty library).
First I’ve made a backup of ~/Music as these steps might make the problem even worse.
mv ~/Music/iTunes Music Library.xml ~/Music/iTunes Music Library.xml.backup
Corrupt the database by replacing it with some data, I suggest
echo 'stupid iTunes' > ~/Music/iTunes Library
Then replace all occurrences to the external hard drive with the original location. In my case the external hard drive lives at /Volumes/Music/Music and the original location was /Users/ckuijjer/Music
perl -pe 's@Volumes/Music@Users/ckuijjer@g' ~/Music/iTunes Music Library.xml.backup > ~/Music/iTunes Music Library.xml
Start iTunes and wait for it to import the XML file
Now lets see if all my iPhone applications are still there and that it still syncs with my iPhone. Also updating Time Machine as I had it configured to skip ~/Music. Changing that to skip ~/Music/iTunes/iTunes Music, e.g. skip the music files itself, but please, please backup iTunes library.
I have the same problem with iTunes,and lost over 13.000 files. I lost the XML file after my hard disk crashed beyond repair. Is there somebody who can help.
You could try to look for the individual mp3 files. They are stored in ~/Music/iTunes on OS X and My Documents\My Music\iTunes Music\ in Windows. The iTunes library files only store some additional metadata such as how many times a track is played, most of the information such as the artist name is also sotred in the id3 tags of the mp3 files.
Thank you for reacting so quickly,
The mp3 files I still have on a different drive,but are not playing. Mediaplayer and Media Monkey are rejecting them as well,I tryed to repair the file headers but to no avail
You could try to remove all the id3 tags from the mp3 files (although it looks like you’ve already tried that). It seems that the mp3 files themselves really are broken. The method I described above only changes the iTunes library itself, not the mp3 files.
Good luck trying to replace the mp3 files
Why is my itunes music libary corrupted after updating my itunes. My music was on itunes, then after updating itunes they are gone off itunes. when I put them back in, and close down itunes, open it up again, they are gone again! What a rat race! Does anybody have any idea what to do?