Skip to content

Instantly share code, notes, and snippets.

@jacobsalmela
Created July 11, 2014 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobsalmela/46df6ceebb2061a57de6 to your computer and use it in GitHub Desktop.
Save jacobsalmela/46df6ceebb2061a57de6 to your computer and use it in GitHub Desktop.
(OS X) Merges multiple Recovery HDs back into Macintosh HD (JAMF Casper Suite Defect D-007146)
#!/bin/bash
# Jacob Salmela
# 2014-07-11
# Fix multiple Recovery HDs created by Casper Imaging from Defect D-007146
# Get last extra Recovery HD by parsing out the bootable Recovery HD, leaving only the extra partitions
lastExtraRecovery=$(diskutil list | awk "/Recovery HD/" | grep -v "Apple_Boot" | awk '{print $7}' | tail -n1)
# Get Macintosh disk ID
systemVolume=$(diskutil list | awk "/Macintosh HD/" | grep -v "Apple_Boot" | awk '{print $7}')
# Erase extra Recovery drives and merge them with Macintosh HD
diskutil mergePartitions JHFS+ "Macintosh HD" $systemVolume $lastExtraRecovery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment