Crashed Mac: rescue files with Linux
We have a crashed 2007 Macbook, which simply won’t boot anymore. The guys at the Mac store were not able to do anything; and gave the standard answer: buy a new one! So we did, and luckily we did have Time Machine backups, which we put on the newly bought Macbook Pro. Unfortunately, the last successfully completed backup was from a few months ago – the system had been gradually crapping up more and more, and apparently wasn’t even able to complete its backups for the last few months of its life.
Now the question is, how do we get all the files off of the disk? We use Linux.
The reason why this is worth trying, is that I highly doubt the harddrive was the problem – I’ve learned to live that Apple hardware barely lives long beyond it’s warranty period and these drives are made by Toshiba, so there was a good chance the drive (and the data) was still salvageable.
I plugged the mac’s 2.5″ drive into my PC (SATA+power). I expected to be able to do a normal boot, but Grub gave an “Error 17”. Turns out it does this when it cannot make sense of partition tables, which could pretty well be if I just plugged in another drive. I didn’t feel like figuring out how to solve that and resorted to something which does work: boot from a USB stick.
So I boot Ubuntu Server from a USB stick I had lying around, and choose “Repair a broken system”. Now it will start to ask the same questions regarding hostname, keyboard layout and location as when installing, but if all is well the top left says “Rescue Mode”.
Now you can choose which partition to use as root. Since I was not sure which one contained my real root (there were quite many) I choose the option to do it without root.
This will drop into a BusyBox with minimal shell environment. But enough to get our beloved data from the mac disk!
dmesg
Shows the partions available. The disk where I wanted to dump the data is /dev/sdd1, so I mount it:
mkdir dumpdrive
mount /dev/sdd1 dumpdrive
The disk from the Mac has two partitions, one vfat and one HFS+ (Mac OS Extended Journalled). Mount the second one:
mkdir macdrive
mount -t hfsplus /dev/sda2 macdrive
(no pun intended with the macdrive). The names on your system may vary (depending on which SATA port you use, for instance). The mount commando requires the “-t hfsplus” argument, otherwise it will complain about “Invalid argument”, meaning it cannot (for some reason) autodetect the filesystem.
Then, we can for instance rescue our iPhoto libary:
cd /media/macdrive/Users/skidder
cp -r iPhoto\ Library /media/dumpdrive
And we move all of it to our dumpdrive which we reserved.
It takes only a few minutes to recover the work lost due to months of bad backups - in this case, because it was the mainboard of the mac which had died, and not the disk.