I lent my hard drive to a friend and he has formatted it as he couldn't get his PC to recognise it. I have no Time Machine backUp. Is there any way of recovering this data?


First step, use a low level tool like dd to make an image of the drive as it exists now, and then stop using the drive. Every second that drive spends connected to a computer (especially a Mac) is a chance for something new to be written to it on top of data you want to recover. All of your recovery attempts should be performed on the image that you make.

Once you have that image, there are a lot of tools you can try to use.

TestDisk can recover the partition table if that was overwritten. If you had multiple partitions, restoring the table will likely magically and immediately "unformat" all except the first one, because all their metadata will still be intact.

The next thing you want to try depends on the filesystem each (or the only) partition had. There are tools explicitly made for unformatting HFS+, various types of FAT, ext2, etc.

If that fails, or even if it doesn't, the final step is to use a tool that will search through the entire drive, sector by sector, and try to put files back together based on their headers. This is prone to failure in cases of fragmentation, but can often recover things that other methods cannot (including deleted files, fyi). I recommend PhotoRec. You might also try some of the Mac-specific tools covered in this article.

  • Stop using the formated drive is the key to success. The dd receipe won't help a Mac user and even an expert sysadmin on Mac ☹. – dan Aug 9 '13 at 8:44
  • 1
    @danielAzuelos Why won't dd help a Mac user? – Sparr Aug 9 '13 at 20:13
  • dd is the way to go. – CousinCocaine Sep 15 '14 at 11:18
  • dd is a hard way :) Out of my few thousands users 10% know how to use Disk Utility. Out of these last ones, only 10% know that dd is a command, and a few of them are able to use it. – dan Sep 21 '14 at 14:04
  • 1
    @danielAzuelos yes, and most of your users won't be getting their data back on their own after formatting a drive. – Sparr Sep 21 '14 at 15:35

Yes you can recover a lot.
First rule to take care of: don't mount the accidentally formatted disk as read/write

Here is how to proceed. Open a Terminal or xterm window.

If your external disk is plugged, run diskutil list and identify from the last column the name of your external disk.

Let's say it is damaged (in reality it will be something like disk1s0).

Unmount it:

diskutil unmount /dev/damaged

Mount it back but read-only:

diskutil mount readOnly /dev/damaged

From now on, your damaged external disk can't be corrupted by OS X (even root and Spotlight won't be able to write to it).

Make a disk image of your damaged disk with Disk Utility, and try any software you want on this safe copy.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .