Created
July 11, 2014 13:16
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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