When a USB stick has been used for, say, a bootable Linux distribution, it usually cannot be re-used as a mass storage device by, say, Windows. These instructions are to wipe/reset a usb stick so it will work as it used to.
(This is largely untested)
on Windows ∞
select disk 1(or whatever)
select partition 1(or whatever)
delete partition override
create partition primary
create partition logical
format fs=[format type] label="[label name]" quick
on Linux ∞
cat /proc/partitions dmesg | tail # you need to be root for that one
The device name is probably something like
/dev/sdc, for these instructions it is
(1) Wipe the bootsector of the USB stick:
drive=/dev/sdx \dd if=/dev/zero of="$drive" bs=512 count=1
Set the type "
FAT32" for that partition.
fdisk can be automated, turning this whole set of instructions into one script.
(3) Write a FAT32 filesystem on it:
drive=/dev/sdx \mkdosfs -F32 "$drive"1