(this used to be a blog)

Terminal to the rescue

Posted: November 18th, 2007 | Author: Panos Karageorgakis | Filed under: Apple, Mac OS X, Technology | No Comments »

Background

I got my digital camera in 2004 and started making a library with all the photos I took in my vacations, journeys and other occasions with more than 2.5k photographs at this moment. These photos resided only in my Powerbook, which means a single point of failure: if something was to happen to the laptop’s hard drive (or even if I dropped it or it got stolen) all those pictures of memories of last years would be lost.

So I got my new iMac last week and decided to move the entire iPhoto library to the new computer, only to find out that there’s something wrong with the disk that won’t let the copy complete. All I got was the spinning beachball. It wouldn’t stop spinning. I tried to disconnect the network drive, turn airport off, press command-alt-escape to relaunch Finder. Nothing.

Disk problems

So I fired up Disk Utility and verified the Machintosh HD disk to get the following error message:

Verifying volume “Macintosh HD”
Checking HFS Plus volume.
Checking Extents Overflow file.
Checking Catalog file.
Invalid node structure
The volume Macintosh HD needs to be repaired.

Error: The underlying task reported failure on exit

Apparently there’s something wrong with the filesystem, probably due to hard drive error, since I heard some “weird” sounds coming from the hard drive. How many of my files were affected by this? I don’t know. I tried to copy each one of the subfolders to the new drive, but whenever it encountered a file that was damaged, all I was getting was the beachball, and then I would have to restart the computer, identify the damaged file and copy the rest of them.

The trick

Well, doing this for my entire library could take forever, so I had to find another way to copy the files to the new computer. Apparently, there is damage in the catalog structure of the FS at some point and Finder doesn’t seem to handle this damage nicely – the whole OS is rendered unusable. But how can one copy files bypassing the Finder, when it’s the only app that does such stuff? Think deeper: Darwin.

So I opened a terminal, and used the cp command to copy all of my files to the new computer, i.e.:

Mac:~/Pictures $ cp -rv iPhoto\ Library/ /Volumes/panagiotis

The -r flag tells cp to do a recursive copy (all files and subfolders inside) and I also wanted to witness the process of copying the files, hence the -v flag (for verbose).

Luckily, the copying of the files was smooth. No delays, no freezes. Well it took sime time to transfer about 7GB of data wirelessly to the new computer, and of course the damaged files did not recover, but at least I managed to copy them to a new disk before this one completely fails some day and doom my entire photo library. After scanning quickly through my library from the iMac (thanks Frontrow + remote!) I concluded that very few pictures were damaged – most of my precious memories are still intact.

So, when the Finder fails, summon Terminal to the rescue.

Share this post:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter


Leave a Reply