For a couple of years, Cindy has been doing her computing on a first-gen MacBook Air that we bought used from a Microsoft developer. (He joked that his boss got sick of him doing presentations with a big glowing Apple logo facing the audience.)
While she was away on vacation, the machine decided to stop booting up. I initially suspected some serious filesystem corruption, but nothing that couldn’t be fixed with some command-line mojo in single-user mode (fsck_hfs apparently has options that aren’t available directly via fsck).
But I wanted to make sure I had a viable backup of her data before mucking around with anything while not in read-only mode. Sadly that turned out to be lots harder than it should have been…
The MacBook Air doesn’t have a Firewire or Thunderbolt port, so there’s no target-disk mode – strike one. (Target disk makes the machine act like an external drive that you can hook to another computer.)
Realizing this might be harder than I thought, I tried booting into the OS X install disc, with a mind to find a way to copy files over the network onto my NAS. Unfortunately this won’t fly because the install disc doesn’t have the required tools – no Finder, no
rsync, no filesharing, and though I could mount the internal disk easily enough in read-only mode, I couldn’t actually make the data go anywhere meaningful.
My next thought was to copy files onto one of the many external USB drives or thumb-drives I’ve got hanging around. I figured this would be easy once I got the install disc booted, and launched into Disk Tools. But the machine only has one USB port, and that was being used by the external DVD drive. I had a USB hub, but the external drive didn’t seem to be recognized on the hub. (Maybe it’s not supported on Mac for some reason.)
So I figured I’d set up the install disc as a remote DVD. That’ll work – then I’ll have the USB port free for a hard disk, and I can copy the files no problem. Problem: Once I set this up, I couldn’t get the Air to see the network-shared disc. I think this is an issue with network discovery on my wireless router, since I’ve had some similar issues with AirPlay not working in some cases.
Ok… What next? Well, let’s try getting networking working in single-user mode and
rsync the files to my NAS. After all,
rsync was sitting right there on the boot disk – all I had to do was get the network up. Whoops – this isn’t as easy as it might be either.
Turns out you have to start up the kernel extension daemon and some services in order to get either the network or the external USB drive support working. It took an hour or two to find the right incantations in order to make this happen.
launchctl load /System/Library/LaunchDaemons/com.apple.kextd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.notifyd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.configd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
But I kept getting a “
Socket not connected” error every time I tried to start anything with
After beating my head on this one for a while, I figured I had to try putting the filesystem into read-write mode or else none of Apple’s services will work.
That got me through getting all the
launchctl commands to work. Phew! Now back to the network.
The machine has WiFi obviously, and I’d already figured out that I could theoretically get that working.
networksetup -setairportpower airport on #etc...
But wouldn’t this be a lot faster with Ethernet instead? I happened to have a gigabit USB/Ethernet adaptor for my other machine, so I plugged that in. It only took a minute to figure out that this is
en7, and I got about half-way through figuring out how to bring it up when I realized something…
Maybe now that
kextd etc are running, I can get my USB 3.0 drive working. That will be way faster than Ethernet. Sure enough I plugged in the drive and then looked at available devices…
And there was
disk1s3. Yay! I wonder…
mkdir /Volumes/usb #ouch - hope I didn't break anything
mount -uw -t hfs /dev/disk1s3 /Volumes/usb
Hey – there it is. Now let’s copy some stuff…
cp -rv /Users/cindy /Volumes/usb/backup
And wait… Well, we’ll see what happens…