Fix Multiple Recovery HDs (D-007146) Created In Casper Imaging and Nested Configurations

Defect D-007146 in JAMF’s Casper Suite creates multiple Recovery HD partitions when using nested imaging configs. This defect is marked as “High Priority” and “Planned for Release” so hopefully we will see a fix soon, but until then, use this as a workaround.

The following script will delete any extra Recovery HDs (while preserving the real one) and merge them with the Macintosh HD.
I created a Casper policy that will run this script with a custom trigger, fixrecovery
.

Now, if I come across a machine with multiple Recovery HDs, I can just run:
sudo jamf policy -event fixrecovery
and my Macs are back to the way they should be!