Copied from the Rasperry Pi Stack Exchange:
(Would have set a Migrate flag, but it's missing from the menu)
You can use DISKPART in Windows, or the equivalent fdisk command under
Linux/Mac.
DISKPART (Windows)
Start a command prompt, and start the DISKPART console. List all of
your disks by typing LIST DISK, then select the proper disk with
SELECT DISK # (where # is the SD card). You can then type CLEAN to
clear the partition table on the card, effectively blanking it. MAKE
SURE YOU SELECTED THE PROPER DISK BEFORE RUNNING THE CLEAN COMMAND!
To create a primary partition to reuse the space on the card, type
CREATE PARTITION PRIMARY. This will then reallocate the previously
"cleaned" space.
To format, type FORMAT FS=FAT32 QUICK, and finally, to reassign a
drive letter, type ASSIGN.
If you're unable to determine the proper disk, remove the SD card, run
DISKPART and LIST DISK, and then re-run it with the SD card inserted.
The SD card is just the disk that has been added.
Note that the above commands are not case sensitive; I used caps to
match the convention DISKPART displays.
FDISK / CFDISK (Linux/Mac)
In a terminal, start fdisk /dev/sdx where /dev/sdx is your SD card
device (may depend on the Linux distro you're using, see below). You
can then delete all existing partitions on the device by typing d, and
then adding a single new partition & format it. You an also just type
n to create a new partition table, and start laying everything out.
cfdisk is also another viable tool, which is basically fdisk with a
greatly improved user interface. In both cases, once the drive is
formatted, you will lastly need to mount it.
If you're unable to determine the proper device, remove the SD card,
run fdisk -l, and then re-run it with the SD card inserted. The SD
card is just the device that has been added.