Skip to content

Instantly share code, notes, and snippets.

@appkr
Last active July 8, 2018 02:10
Show Gist options
  • Select an option

  • Save appkr/47879943fdb74743dcbc1a0e3b5f5820 to your computer and use it in GitHub Desktop.

Select an option

Save appkr/47879943fdb74743dcbc1a0e3b5f5820 to your computer and use it in GitHub Desktop.
MacOS disaster recovery

Summary

  • the iMac in the home was always yelling to upgrade the OS version for a long time.
  • but I ignored the alert.
  • Today I had a spare time and saw that alert again. I pressed "upgrade" and I quickly realized that I was mad.
  • so I was panicked. Even though I cannot remember what I have tried though, it was apparent that problem was arose because of the new file system(APFS) adopted starting from High Sierra.
  • (deep sigh) myself should be blamed.

in another mac machine

Format an external disk - 1st try failed

$ diskutil list

$ diskutil eraseDisk JHFS+ LEEF /dev/disk2s2
# A volume was specified instead of a whole disk: /dev/disk2s2
# Specify a whole disk, or instead use diskutil eraseVolume to erase a volume on a specific partition

Format an external disk - 2nd try failed

$ diskutil eraseDisk JHFS+ LEEF /dev/disk2
# Started erase on disk2
# Unmounting disk
# Creating the partition map
# Waiting for partitions to activate
# Formatting disk2s2 as Mac OS Extended (Journaled) with name LEEF
# newfs_hfs:
# WriteBuffer:  pwrite(3, 0x10f0d7000, 131072, 25038848): Device not configured
# newfs_hfs: write (sector 48904): Invalid argument
# Mounting disk
# Could not mount disk2s2 after erase
# Error: -69832: File system formatter failed

Finally succeed with another external hdd.

Prepare external boot disk

Download Sierra OS installer

$ sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/USB $ --applicationpath /Applications/Install\ macOS\ Sierra.app

with another external hdd

$ sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/wd --applicationpath /Applications/Install\ macOS\ Sierra.app
# Password:
# Ready to start.
# To continue we need to erase the disk at /Volumes/wd.
# If you wish to continue type (Y) then press return: Y
# Erasing Disk: 0%... 10%... 20%... 30%...100%...
# Copying installer files to disk...
# Copy complete.
# Making disk bootable...
# Copying boot files...
# Copy complete.
# Done.

in the target machine

Recovery

  • attach the extarnl booting disk
  • boot Mac with opt pressed
  • select the external disk as the booting disk
  • when dialog pops up, select Disk Utility, and format the target(==damaged) disk
  • exit back to the dialog and install MacOS
  • select the target(==formatted physical disk) and install the OS

References of the best

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