I used a
dd-inspired tool like mkusb on a flash drive before, like the mkusb Ubuntu help page says they:
'use the whole device', actually only the head end (size of the iso file), but the rest of the device is not available. mkusb simply clones the ISO 9660 file system with its content from the iso file. This ISO 9660 file system works from CD/DVD disks, and also from USB drives. After using a USB pendrive like this, you make a new partition table and file system, if you want to use it for another purpose.
Down the the link chain leads to Help to Format a USB pendrive. Creating a new partition table, then partition(s) should do the trick, unless you run into the "special cases" of a problem flash device. The one I had just wouldn't really listen and would occasionally pick up remnants of the old ISO filesystem months after formatting & reusing it.
Overwriting the first gigabyte (where the ISO originally was) solved my problem, but if you wanted to overwrite the entire USB that should work too (at the expense of one less lifetime writes to the flash memory), or just the first megabyte is supposed to work too...
dd from linux should do it. First make 100% certain you have the correct device (like
gnome-disk-utility or watching
dmesg/the syslog when plugging in the device should tell you)
To overwrite just the first megabyte (1M, where M =1024*1024) you'd do
dd if=/dev/zero of=/dev/sdx bs=1M count=1
To overwrite more M's use a larger count.
To overwrite the first gigabyte (1G, where G =1024*1024*1024) do
dd if=/dev/zero of=/dev/sdx bs=1G count=1
To overwrite the entire device, don't use any bs or count, just do
dd if=/dev/zero of=/dev/sdx
When it's finished
dd will tell you how much it was able to write before reaching the end of the device, giving you an idea of how much is really writeable, similar to this:
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.000838339 s, 1.3 GB/s
dd is taking a long time you can "Send a USR1 signal to a running 'dd' process mak[ing] it print I/O statistics to standard error and then resume copying." Use
htop or maybe even
killall if you're careful, or see
man dd for an example like:
$ dd if=/dev/zero of=/dev/null& pid=$!
$ kill -USR1 $pid; sleep 1; kill $pid
18335302+0 records in 18335302+0 records out 9387674624 bytes (9.4 GB) copied,
34.6279 seconds, 271 MB/s
dd is finished, write a new partition table and make a new partition and format it. I'd use
gparted, it's got a create partition table option in a menu, and usually works well.