Friday, January 20, 2012

hdiutil and OS X data recovery

Your hard drive fails, so the first thing you do is grab dd and pull a byte-by-byte copy of the drive's contents:
   dd if=/dev/bad_drive of=bad_drive.img conv=noerror,sync

Problem is, if the drive was from a Mac and you want to use a recovery tool like Data Rescue or Drive Warrior, you'll probably need to attach your drive image as a loopback device, and double-clicking the file to mount it doesn't work when the filesystem is fragged.

Enter hdiutil:
   hdiutil attach -nomount bad_drive.img

No comments: