Delete Bootcamp and other multiple partitions from external disk / hard drive / ssd under macOS

The built-in Disk Utility app is suprisingly negligent with external drives that have at least one non-HFS+/APFS partitions on it. Multiple partition external drive partitioning requires some extra steps to be done. We are going to destroy the complete partition map so that the drive can be reformatted into one whole partition using Disk Utility – essentially, a clean slate. Open up Terminal and let’s get destructive!

Disclaimer: you are exclusively responsible for taking these steps by following along.

If at any point you get permission errors, preface the commands with sudo (eg.: sudo fdisk /dev/disk3). I’ll be using disk3 as an example.

Find out which disk we need to do surgery on:

diskutil list

Note the name of the partition and the volume. Let’s take a look at the raw partition table:

gpt -r show disk3

You should take note of the index number next to the partition. If you only have one partition then it will most likely be “1”.

Let’s check the MBR side of things – also remember to take note of the index number here as well:

fdisk /dev/disk3

Unmount your partitions:

diskutil unmount "/Volumes/BOOTCAMP"
diskutil unmount "/Volumes/External Drive"

Delete the partition with gpt:

gpt remove -i 1 disk3

You might need to unmount. Next up, we will remove the MBR (Master Boot Record) from the drive, essentially destroying the BootCamp boot capability. We will be editing everything by hand.

fdisk -e /dev/disk3

You will be on the command line of fdisk. The commands in bold are the ones you need to type. First, we check out the partition table:

fdisk: 1> p

The idea is to replace everything with one whole partition of type EE that covers the whole disk.

fdisk: 1> erase
fdisk:*1> edit 1
Partition id ('0' to disable) [0 - FF]: [0] (? for help) EE
Do you wish to edit in CHS mode? [n] n
Partition offset [0 - 505856]: [63] 1
Partition size [1 - 505855]: [505855] <hit Enter>

Let’s check what we’ve done:

fdisk: 1> p

You should see one entry that is of type EE and all other entries are blank. Time to write the changes to the disk:

fdisk: 1> w

As a final step, we have to quit:

fdisk: 1> q

Unplug and re-plug your disk, Disk Util should complain about initialization – go ahead and format your disk, we’re done!

Reblogged from StackExchange, original author is pmdj.