Recover data from a non booting Macbook Air (OSX 10.6 and 10.7, and probably 10.8)

The Macbook Air is the best tool for someone whose main function is to attend to meetings. Although the new (2011) models all feature SSDs, the older models only offered those as an option. As such, even the best build machines are not free from hard drive failures, which remain as the component with highest failing component.

Regardless, in case you get stuck with a non booting Macbook Air,  here’s how to recover the data:

1. First, why does this even works? Simple. OSX uses a kind of file system called “Journaled“, which is far different from FAT or NTFS, but is quite similar to ReiserFS, XFS or most UNIX file systems around. The advantage? Consistency is (almost) allways assured, even in case of a power failure, or hard drive failure. So, even if a hard drive is having problems, it’s usually capable of giving up it’s data.

2. DON’T TRY TO BOOT. If OSX fails to boot 3 times, don’t try the forth. One of the most interesting feature of a UNIX system, is the ability to boot WITHOUT WRITING to the hard drive. This allows for a failing hard drive not to do even more damage to it’s contents. This is half the reason why on a Windows system, if a hard drive fails, it continues to loose data every time it tries to boot. In OSX, boot into single user mode, by pressing CMD + S on boot. This will make the system boot in single user mode, with a read-only file system. Neat :).

3. CHECK THE FILE SYSTEM. After booting in single user mode, the first thing to do is to check and fix the file system. Type the following after finishing boot:

fsck -yf (fisrt, and whait for it to finish, then)

mount -uw /

This will allow us to check if the file system and the hard drive has any problems. If it does, it’s time to use a portable hard drive to recover the data

Advertisements

4. Mount the hard drive. This is the tricky part. On OSX, having USB support is not embedded on the kernel, and some services need to be up for the hard drive to be recognized so, plug the USB hard drive and use the following commands:

launchctl load /System/Library/LaunchDaemons/com.apple.notifyd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.kextd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.diskarbitrationd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.configd.plist

and wait for the message “DSMOS has arrived”. If it doesn’t appear for 10 minutes, try plugging the USB hard drive prior to booting. Note, the USB drive MUST be formatted on HFS.

If it does, all that remaining is getting into the hard drive. First check the path to the hard drive. Type

ls /dev/disk*

and check for anything different from disk1s2, usually disk2s2.

5. Create the mount point:

Advertisements

makdir /Volumes/USBDrive

6. Mount the hard drive:

mount_hfs /dev/disk2s2 /Volumes/USBDrive

7. Copy the contents to the drive:

cp -R /users/* /Volumes/USBDrive

Hope this helps someone.