| Power off. Physically disconnect all hard disks, flash drives, and any other writeable media. Select a linux live CD with just the bare-bones functions: a command shell with 'dd' is all you need. The first install disk from just about any of the popular linux distributions should work for this, or use a "system rescue" live CD such as UBCD4Win. "Kitchen sink" live CDs (so named because they try to include everything but the kitchen sink, and sometime that too) like Knoppix are not ideal, as they may try to auto-mount your media.
Boot the live disk and get to the command shell. Connect the untrusted flash drive. At the command prompt, type
dd bs=1073741824 if=/dev/zero of=/dev/sda
Note that we are writing to the whole device 'sda' and not a partition 'sda1'. Also note that the flash drive may be identified differently as 'sda' or 'sdb' or 'sdc' or 'hda' or 'hdb' depending on what live CD you use, what hardware is detected, and in what order the hardware was discovered this time the system booted. If you get an 'out of memory' error, change the block size from 'bs=1073741824' (1 GiB) to 'bs=1048576' (1 MiB).
Blanking the flash drive takes a few minutes to complete. One pass is all you need to be rid of whatever cruft was there before. Multiple passes would only shorten the life of the media. The flash drive is now safe, but not yet useful. It still needs to be partitioned [1] and it needs a file system. You can probably do both with whatever tools are included on your live CD (fdisk, cfdisk, parted, mkdosfs), but you may find it easier to use your usual partitioning and formatting tools. So at this point feel free to power off, reconnect all your harware, and boot normally to your preferred operating system.
[1] Although you could put a file system directly on the whole device, this so-called 'superfloppy' format is deprecated and may not get along well with some systems. The current practice is to have a partition table (either msdos or gpt) with only the first partition defined. |