Monday, July 15, 2013

Recovering files from a crashed Mac

[Edit]  The original post assume you were running OSX 10.7 (Lion).

OSX 10.8 (Mountain Lion) will not let you boot from a Linux CD (at least not for me).  So now what?

Method 0: Use the terminal for copying files.  If you boot to the recover utilities (which are part of the Mountain Lion disk as a separate partition - boot up with the option key depressed), there's a Utilities pull-down with "terminal".  It's not that bad as long as you know:

- /Volumes/USBXXX/* has the USB drive you plugged in

- /Volumes/MacintoshXXX/* has your hard-drive files you want to recover

- /Volumes/MacintoshXXX/Users/frankbraker_or_whatever_your_username_is/.* has your hidden files and directories (use ls -a to see them)

- /Volumes/MacintoshXXX/Users/frankbraker_or_whatever_your_username_is/* has everything else

- /Volumes/MacintoshXXX/Users/frankbraker_or_whatever_your_username_is/Library/Keychains has your keychain files

- XCode 5.0 automatically generates provisioning… and "of that which we cannot speak, we must remain silent" Ludwig Wittgenstein.

- cp -r sourcepath/* destpath/.  copies directories recursively


For example, this will back up all your .ssh config files:

mkdir /Volumes/USBXXX/.ssh

cp -r /Volumes/MacintoshXXX/Users/frank/.ssh/* /Volumes/USBXXX/.ssh/.


This was all off the top of my head… buyer beware!  :)






//---------------------------------- ORIGINAL POST BELOW ------------------------------

Scenario:  My Mac won't boot anymore and the disk utilities say the disk can't be repaired, and that I should recover all the files that I can before formatting and reinstalling the OS.  But how to recover the files?


Method 1: Firewire

1) Spend money for a Firewire cable.

2) Boot the Mac with the "t" key depressed which puts it into external HD mode

3) Copy files (watch this video if you're interested: http://www.youtube.com/watch?v=bVRx6R6hs9Q


Method 2: Linux boot disk

0) Wonder why you have an OSX installation USB drive, but it can't boot to copy files.  Maybe it does if you know the secret handshake?


1) Plug in an external drive large enough.

2) Boot with a Linux CD.

     a) Before your Mac is toast: burn the CD from here: http://www.linuxmint.com/download.php

     b) After your Mac is toast: while powering up, press the "option" key and select the CD.  I recommend Linux Mint because it doesn't require that much command line knowledge to use effectively.


3) Open a file browser.  If you try to navigate to the Mac drive, it will work until you get to user files (which are "protected").  But you can open folders as admin (in a pull-down menu right clicking on the folder).


4) The file browser works fine for copying, and especially for compressing large folders onto the external drive (because I want .zip rather than .tar or .gz, although those are available too).


Alternatively, once you've opened a folder as admin, open a folder with a terminal (same pull-down menu) - the terminal will be open as admin (red "mint" username), and disabled commands now work:

cp -r folder/* /media/<external drive name such as "4D84-911B">/folder/.