.comment-link {margin-left:.6em;} <$BlogRSDURL$>

Monday, December 11, 2006

The Definitive Guide 

So I've been concerned. Worried you might say. My iTunes library (and other files too, just so you know) have been living life out on the edge. I, along with pretty much everyone else on the face of the internets, don't practice regular backups. With DVDs holding only a bit over 4 Gig and affordable drives going over 500, backing up is a huge pain. It's been my plan for a while now, to get one step closer to backing up my data. The major risk at Casa Hank (besides the Big One hitting the San Andreas, of course) is the loss of a drive.

If you've been reading your Slashdot, etc, you'll know that you can protect yourself from drive failure by setting up a RAID1 system. RAID1 is where you have 2 (or more perhaps) drives of identical size and they have the identical data on them. So if one fails you can pull it out, put a new one in and re-build the image. This, it needs to be repeated, is not a back up. If the Big One does hit, both drives are probably toast.

So I set one up. CompUSA had the right price on Maxtor 500 Gig drives and I got myself a pair of them. Then I got a nice dual-drive Firewire enclosure and set up the RAID1.

iTunes has a cool feature in the Advanced menu item: Consolidate Library... If you set the library location to a particular folder (say, one on your new RAID1 drive) and select Consolidate Library... it will copy every song from its old location to its new home in the new folder. Or at least it's supposed to. I think (WARNING! I'm making this part up) that writing to RAID1 drives is slower than writing to a single drive, and that iTunes expects things to happen at a particular rate and if they don't then there is a problem. iTunes refused to copy more than about 10% of the library to the new drive no matter how I begged and pleaded.

One solution to this problem is to copy everything by hand and then rebuild the library. This would work great except that I would lose all my metadata (play counts, ratings, etc) and I didn't want that to happen.

In my day-job I write Python code and one of the super-cool things available for Python on the Mac is a module called Appscript. It allows the Programmer to send AppleScript commands to programs via Python. My next idea was to copy everything over by hand and then use Appscript to programmatically set the location attribute of each song to its new home. Alas! The location attribute of the file_track is read-only. Dang.

But then, prompted by a comment on the MacPython mailing list and heartened by some Google results, I hit upon Hank's Foolproof Library Migration Schemetm:

And that's all it takes.

Comments: Post a Comment


This page is powered by Blogger. Isn't yours?