iTunes surgery
After the arrival of the new 1TB disk from LaCie I decided to offload the 45GB of music from one of my aging disks connected to the Linksys NSLU2. As data was phsyically copied from one device to another one, I decided to use one of my PCs to do the copying (using the Ethernet interface instead of the wireless interface).
I mounted both drives, old and new and simply dragged the “music” folder from the NSLU2 attached device to the LaCie disk. Copy progress dialog comes up … mentions some 180 mins to copy all the files … fine … go ahead and copy the stuff. 3 hrs later I look at the PC again. The dialog has gone, no error on the screen, which seems to indicate that things have been copied successfully.
Back on the Mac, I “File > Export …” my entire library from iTunes (producing a Library.xml file on my Desktop). Next I change the Preferences for iTunes to look at the new “music” folder on the LaCie disk, followed by some perl massaging of the Library.xml file (I just change all the “Location”-pathnames to point at the new location of the files). In iTunes I delete all entries/playlists and “File > Import …” the changed Library.xml file. Whoa! Roughly 1500 files are missing from the collection after the import is done.
I backtrack my steps and don’t find any errors. Where did I miss those 1500 files? I end up creating file-lists for the old location and the new location (”find . -type f -print” on both of the shared volumes). After writing some more scripts, I figure that those 1500 files simply did not get copied. Windows Explorer completed the copy-process without errors/warnings, however those files are just not there.
Should I copy everything again? On a different system?
I decide against it. Back on the Mac, I mount both volumes and use rsync to synchronize the volumes. If you have not used rsync before, let me tell you, it’s one of those command line utilities that is essential in every collection. Besides being able to synchronize two “directories” on your local system, it can do the same job over the internet (using ssh, rsh, etc.). I’ve used rsync extensively in the past when I had to make sure that several machines had the exact same copy of the same files.
Because the clocks on both of my file servers are not in sync, the first attempt with “rsync” seems to copy all the files again. I quickly figure that timestamps of the files are the issue and I rerun the command with the “–size-only” argument. This way “rsync” will only use the filename and the filesize to determine whether to copy a file or not.
After an hour the copy process has completed. I look at the list of files that were not copied via Windows Explorer and I don’t see a pattern that would give me a clue as to why those why not copied in the first place.
Some more processing of the Library.xml file and I’m ready to import the library back in iTunes. As expected everything is there this time and operations seem to be snappier as well. And before somebody suggests that I should have done a “Consolidate Library …” after changing the iTunes music folder: remember that the Mac is wireless only and it would have taken quite some time to perform that operation.