List all your internal and external storage devices
diskutil list
Erase and format the disk (add disk # from above). Be careful to verify the correct disk (size and name).
sudo diskutil eraseDisk FAT32 SDCARD MBRFormat /dev/disk#
Source: https://thomas.vanhoutte.be/miniblog/reclaim-the-full-storage-capacity-of-an-sd-card-on-macos/