How to - disk recovery with ddrescue on Mac 10.4

Posted on January 13, 2007 in How-to

I had a dead, clicking hard drive. It would not mount so most repair utilities and Apple Disk Utility couldn't see the drive to repair it. Data Rescue II and DiskWarrior (even advanced recovery mode) would run for a while but eventually error out. dd_rescue (read third comment) is a linux utility that is very powerful and persistent but wouldn't compile for me in Mac OS 10.4. I finally had success with a similar linux tool ddrescue and this article.

What you will need:

  • Dedicated Mac w/OS 10.4 - some recoveries can take up to a week to complete. Make sure you have 2x the damaged drive's disk space available
  • Install Xcode 2.4 and developer tools
  • Replacement hard drive - Same size as the damaged drive. You may be able to use a partitioned drive but It didn't work for me.
  • USB 2.0 drive enclosure for 2.5" hard drive - assuming you are recovering a laptop HD. Get Firewire if you can find one. This enclosure from Compusa was only $20... I got two.
  • Extra USB cable (mini to standard in my case)
  • DiskWarrior
What I did: You can get a majority of the steps from this article.
- Download, configure, and install ddrescue. Notice where the ddrescue binary is installed and move it to /usr/sbin or anywhere in your $PATH you wish. This way you can just run the ddrescue command from anywhere in the command line.
- Open the Terminal program and run these commands
% df
% ls -la /dev/ | grep disk
We'll use these to determine the disk's volume number (don't close the window)
- Install the damaged drive into the drive enclosure and connect to the computer. My enclosure came with a USB power cord so I used another USB cord to make the USB serial connection. I don't think the power connection was necessary though YRMV.
- Run this command and check the differences with the above results to determine the disk volume number
%ls -la /dev/ | grep disk
You should see a new set of disk numbers (disk1, disk1s1, disk1s2). If not check that the drive is connected and that the light shows disk activity. It may take a minute or two for the drive to register. Even unmounted drives will appear in this list.
% cd ~/Desktop
% sudo ddrescue -v /dev/diskXsX MyVolImage.dmg MyVolRescue.log
Where diskXsX is the damaged drive's volume number
- Open another terminal window and enter
% tail -f ~/Desktop/MyVolRescue.log
This will show all changes to the Rescue log so you know things are happening.
- Open another terminal window and enter
% sudo fs_usage | grep ddrescue
This monitors all system disk activity and is a bit more active than the Rescue log.

Now you wait... and wait... you can watch the logs with the tail and the stats from the ddrescue command. It's very interesting to watch but just come back every day and check the progress. You can stop the program and start again without losing anything, thanks to the log, but be careful. I stopped the program and unplugged the drive and had to start the process all over again (three days recovery lost).

When the process is finally complete you will have a .dmg and log file on your desktop. Back these up or risk having to repeat the process again.
- Next put the new replacement disk in the enclosure.
- Determine the disk volume number in the same fashion as before.
- Now we will use ddrescue to copy the recovered image to the new undamaged disk.
% sudo ddrescue -v MyVolImage.dmg /dev/diskXsX MyVolRestore.log
This should run more quickly but may still take about a day, maybe two.
- Once completed I still couldn't mount the disk but was able to run DiskWarrior completely and repair the disk. Then I could copy the files I needed.

It's a very long and dedious process but it is a great feeling to recover someone's lost wedding pictures. I even got an extra christmas present this year.