Yeah, that too.
GParted will write a new MBR, by the way. Or at least the program version (an installable program in most Linux distros) will. The standalone (bootable from a disk) GParted should also be able to.
Although if you know how to do it with dd, kudos. Go with what works.
Here is the instructions I followed to get my usb drive to work again.
sudo blkid
sudo dd if=/dev/zero of=/dev/sdX bs=1k count=2048
sudo parted /dev/sdb mklabel msdos
sudo parted -a none /dev/sdb mkpart primary fat32 0 2048
sudo mkfs.vfat -n "Disk" /dev/sdb1
* It recommends that I use "DISK"
https://askubuntu.com/questions/185815/how-do-i-clear-everything-data-viruses-from-a-thumbdrive
You can use good old Linux tool dd to do this.
To do so:
First open a terminal with pressing Ctrl+Alt+T.
Then type sudo blkid in the terminal.
Very carefully and closely examine the output.
[sudo] password for anwar:
/dev/sda1: UUID="63c6fb01-aac4-4d38-b29e-5a5780a98d12" TYPE="ext4"
/dev/sda2: LABEL="Main" UUID="A80C1BD70C1B9F7E" TYPE="ntfs"
/dev/sda5: LABEL="Work" UUID="01CCB271A80A07E0" TYPE="ntfs"
/dev/sda6: LABEL="Edubuntu" UUID="364126ac-01c9-4dd2-ab19-eecc733a9640" TYPE="ext4"
/dev/sda7: LABEL="Windows" UUID="5A8C72C98C729EE7" TYPE="ntfs"
/dev/sda8: UUID="312d4cd9-21a9-4c0d-aa34-26230e70fa89" TYPE="swap"
/dev/sdb1: UUID="E87F-1D12" TYPE="vfat"
Look at the last line with /dev/sdb1. That is the USB drive which is formatted with Fat (vfat) file system. Note that, the USB drive has only one partition which is named /dev/sdb1. If it had other partitions, they would have been named as /dev/sdb2 ... and so on. The USB drive itself is named /dev/sdb, Note that, it doesn't have a 1, 2 or any number after sdb
Then execute this command to replace all of the data in the USB drive with 0.
sudo dd if=/dev/zero of=/dev/sdX bs=1k count=2048
I intentionally haven't given the original /dev/sdb in the command, so that new users do not accidentally mess up their system. Replace the USB drive name found in step 4 in the above command.
This should give you a clean USB. You need to create at least one partition to use the USB after this operation.
Creating partition on the empty disk
To create a new partition on it, You can use parted program. I'm giving an example of creating a partition in a complete raw disk. Our USB disk is 2GB (~2048) in size. We assume, it's device name is /dev/sdb. You can check your device name with the command sudo lsblk (you have to guess the correct device by looking at size and etc).
First we need to eject the USB after the last command and re-insert it.
Then we need to create a partition table on the disk. We are going to create a partition table of type msdos, sometimes known as Master boot record.
sudo parted /dev/sdb mklabel msdos
Then you are adding an empty "primary" partition, which will hold a Fat file system later.
sudo parted -a none /dev/sdb mkpart primary fat32 0 2048
We specified the start point (from 0 MB) to the end point (2048 MB), though actually the disk may not have full 2048 MB space, but don't worry, parted will adjust it automatically. Note we are creating a single, primary partition on the whole disk. But you can create multiple partition on it. (Though it is not recommended, because Windows will only recognize the first partition).
This newly created partition will have the id /dev/sdb1
Then finally create a Fat filesystem on the /dev/sdb1 partition by doing formatting.
mkfs.vfat -n "Disk" /dev/sdb1
We are creating a fat filesystem on /dev/sdb1 partition with the name "Disk".
That's it. You have now a new clean USB disk with a fat partition.
Note, you can also use the Disk-Utility program to create partition and Format it with Fat.