Jul 28, '05 08:46:00AM • Contributed by: Bruno LEGAY
I had a problem with my disks (an original Maxtor from a dual G5). It had three HFS Plus journaled partitions. Suddenly, the system would not boot. When looking at the disk with Apple's Disk Utility, the disk is visible, the name of the volume is not displayed (/dev/disk0s5 was displyed instead), and the volume would not mount. Using Apple's Disk Utility repair function failed to fix the drive.
I tried using DiskWarrior, but it was really slow -- the message was saying something like "speed inhibted by disk malfunction." It was so slow, I was not sure if it had crashed, or if it would take weeks to get through. So I decided to look what other tools were available, I looked on macosxhints, and found this article about using dd to make a block copy of a volume (e.g. /dev/disk0s5). Then, looking aroung on the net, I found a Linux tool called GNU ddrescue made by Antonio Diaz Diaz (not to be confused with dd_rescue written by Kurt Garloff, which was mentionned in one of the comments of the original article).
I tried to compile ddrescue on Panther and it did not work. I then tried to compile it on Tiger, and it worked the first time (great to see Linux tools compiling on OS X without causing a headache). To compile, open the Terminal and cd to the ddrescue directory, and then run the following commands:
$ ./configure
$ make
Then you can run ddrescue (once compiled, it would probably also run on 10.3).The syntax for ddrescue is quite simple and here are the steps I followed:
Copy the content of the volume into an image file:
sudo ./ddrescue -v /dev/disk0s5 MyVolImage.dmg MyVolRescue.log
The were errors reported during the copy of few blocks. ddrescue retried several times until I considered that there was no hope to recover these dead blocks (initially there were read errors on about 3000 blocks, and at the end, it turned out that 900 blocks had died). The computer really slows down (everything freezes) during that kind of operation.
I was monitoring the action by looking at the log ddrescue produces, and using this command:
$ sudo fs_usage | grep ddrescue
A cool feature of ddrescue is that you can stop and resume its activity. It will use the log file to pick up where it stoped last. Then I tried to mount the image file, but it did not work. I don't know why not; maybe because it was an HFS Plus journaled partition.
So I got a new disk (to be sure there were not bad blocks and to keep the original disk intact, just in case) and created a partition with pdisk of the exact same size (number of blocks) of the original partition (and the image file, remember a block is usually 512 bytes). Then I used ddrescue to copy the image file back onto the new partition:
$ sudo ./ddrescue -v MyVolImage.dmg /dev/disk1s3 MyVolRestore.log
I was then able to run DiskWarrior to repair the remaining problems (faster this time because there were no bad blocks) on that new partition. After that, I was able mount the volume and get my most important files back.
