Skip to content

Instantly share code, notes, and snippets.

@dphiffer
Last active July 21, 2017 09:44
Show Gist options
  • Save dphiffer/86d6b11081c0b0bc2c4e74510bedfefd to your computer and use it in GitHub Desktop.
Save dphiffer/86d6b11081c0b0bc2c4e74510bedfefd to your computer and use it in GitHub Desktop.
How we dealt with the @eirons disk failure of 2017

How we dealt with the @eirons disk failure of 2017

Context Drive that won't boot

  • Boot Sad Laptop into Single User mode (hold down cmd-S on startup, reference)
  • Make the disk writable: mount -uw /
  • Plug in an external drive
  • Determine which disk the external one is: ls –l /dev/disk* (in this case /dev/disk2s1)
mount -t hfs /dev/disk2s1 /mnt
mkdir -p /mnt/backup/eirons
emacs /mnt/backup/rsync.sh
#!/bin/bash

rsync -rv -n \
  --exclude '.DS_Store' \
  --exclude '.Trash' \
  --exclude '*Creative Cloud*' \
  --exclude 'Dropbox' \
  /Users/eirons/ /mnt/backup/eirons/

Notice the -n flag? That makes rsync do a "dry run" (no files copied)

  • Make it exectuable: chmod +x /mnt/backup/rsync.sh
  • Make a list of the files that would be copied
cd /mnt/backup
./rsync.sh > files.txt
  • Eject the disk: umount /mnt
  • Inspect files.txt on Other Laptop and see if we can avoid backing up anything unnecessary
  • Edit rsync.sh accordingly
  • Take off the -n flag so that rsync will actually copy files
  • Plug the drive back into Sad Laptop
mount /dev/disk2s1 /mnt
/mnt/backup/rsync.sh

Watch the files scroll by for a while.

umount /mnt
reboot
  • Hold down cmd-R to boot into Recovery Mode
  • Use Disk Utilities to format the drive (yeah this step is where shit gets real), I just went with the default settings
  • Quit Disk Utilities

Don't bother trying to re-install OS X from the built-in Yosemite installer because, after doing a hilarious job shoehorning 2FA code "after your password in the password field," it just says "this item is temporarily unavailable." Like the App Store just decided (temporarily?) that we're not allowed to re-install the system. Yeah, welcome to the not-owning-your-own-hardware world. We've been in that world for a while.

"I'm sorry Dave..."

  • Download the macOS Sierra Installer (reference)
  • With the newly-minted USB thumb drive installer plugged into the Sad Laptop, boot up with the option key held down
  • Boot from the macOS Sierra Installer by hitting enter
  • Yadda yadda, choose the language, accept the terms, install to the disk you reformatted earlier
  • Wait for a while

wtf, it worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment