I had same issue - could not partition or erase drive as I was receiving an error:
MediaKit reports not enough space on device for requested operation.
So I found this site which I replaced disk1 with disk2 as my disc was named disk2
Disk Utility fails to erase/format an external HDD (El Capitan). "Mediakit reports not enough space on device for reques…
diskutil list
to get the name to the disk you're trying to format. The below commands assume this is "disk1", but replace "disk1" with the correct disk if it's something different.
Now unmount the disk:
diskutil unmountDisk force disk2
and then write zeros to the boot sector:
sudo dd if=/dev/zero of=/dev/disk2 bs=1024 count=1024
finally attempt to partition it again:
diskutil partitionDisk disk2 GPT JHFS+ "My External HD" 0g
I would hope that Apple would fix the formatting process so I would not have to use Terminal. But it works now, So I am good.