I came across a Samsung 32GB USB drive. When I plugged it in, the partitions were a mess. Here's what I did
Format your disk from the Terminal using diskutil
command, for example:
Partition using diskutil
:
diskutil partitionDisk diskN GPT JHFS+ "My External HD" 0g
Erase boot sector with zeros (make sure you won't erase the wrong drive!):
sudo dd if=/dev/zero of=/dev/diskN bs=1024 count=1024
Warning: Above commands wipes all data on /dev/diskN
, so make sure you've it correct!
Unmount the drive (replace diskN
with your drive):
diskutil unmountDisk force diskN
List all drives:
diskutil list
Source: Disk Utility fails to erase/format an external HDD at reddit.