I recently wiped a white Macbook 3.1 from 2007 to install Xubuntu. It turned out that important data was lost during this (or even during a re-installation two years ago).
Luckily, with some magic I was able to restore all lost data. For this, I used the free software PhotoRec by Monsieur Grenier. In Ubuntu, it can be installed as a bundle with TestDisk (which is another great tool) using
sudo apt-get install testdisk. Launch
sudo photorec for root access.
The first step is to select the disk to work on (in my case
/dev/sda). I also have an external hard drive (
/dev/sdb) hooked up to store recovered data somewhere else and to not overwrite any potentially yet un-recovered data.
Since I partitioned the disk during re-installation, I choose the [Whole disk] rather than any partition for recovery. For speed, it is recommended to limit data recovery to the relevant filetypes (f.e. .pdf, .jpg and .zip) using the File Opt menu.
The software needs to know the filesystem type. The laptop was running OS X prior re-installation so my choice is Other.
Recovery starts after selecting the output folder (for me
/dev/sdb/). PhotoRec reports all recoveries while running and can take multiple hours. This also depends on the second hard drive to store the recovered files - the faster, the better.
Recovered files are stored in folders
… And there are multiple ways of restoring the original filenames or sorting the recovered files here.