In this mini-guide I will walk you through a somewhat simple task, but one that can often elude people on how to properly reformat a stuck USB Flash drive on Windows. I am using the term stuck to mean a USB flash drive that is in a state where the normal Windows formatting does not work as Windows can no longer detect the proper size due to partition changes or corruption. This can come about for various reasons, one instance that I encounter often is if I used the USB flash drive in a computer with another OS, such as Linux. Other times flash drives just become corrupt on their own and this technique can sometimes be used to salvage the drive. Of course, with flash drives as cheap as they are now, if it is questionable you may be better off just throwing it away.
Now let me clarify, this isn’t a guide about file recovery, it is simply how to reformat and wipe clean a USB flash drive to return it to full storage capacity. It is not a guide on how to recover files or resurrect a dead USB flash drive. Once this procedure is finished, your USB Flash drive should be returned to its like new state ready for use.
And I will also mention that while this is deviating a bit from the Cryptocurrency theme of the site, since it is a common enough problem people run into, especially cryptocurrency miners, I thought a mini-how to wouldn’t hurt anything and may help a few folks that find themselves in such a position.
To begin, insert the USB flash drive into an available USB slot. Wait for Windows to detect it and look under My Computer to see which drive letter it was assigned and how much space is available. In this example I am reformatting a 16 GB Micro USB Flash Drive that had once held BAMT when I used to scrypt mine. I wish to reuse this drive to use as the installation media for a new Linux Mint install, and I am using Windows to download the media and format the drive.
In the image on the left, I can see that my computer detected the drive and assigned it as the “J:” drive. However, Windows only shows that 16 MB out of 512 MB is free, well short of the 16 GB flash drive’s capacity. If you try formatting this drive with Windows by right clicking on the drive and “format”,it will only recognize and format the 524 MB it recognizes as shown below.
There are a couple of different approaches to reclaiming the “lost” capacity, but maybe one of the easiest is to simply use the built-in Windows utility, DiskPart. DiskPart, short for “Disk Partition” utility, is a command line based tool that allows you to manage drive objects (disks, partitions, and volumes) using either the command line directly, or more conveniently in a script format. For a complete listing of its capabilities refer to the TechNet article from Microsoft here.
For this simple task, we will be using the command line directly as it is pretty straightforward.
Open up a command prompt (Windows>Start, type: “cmd” in search) and type DiskPart, as shown in the first window above. This window will stay open, but a new Window will open with the utility running, this is indicated by the DISKPART> prompt (lower window shown above).
The first command we will type is “list disk”. This will display all the disks currently on the system. The disk we want will usually (not always) be the last on listed, in this case Disk 6 (shown below). This can be further confirmed by looking at the size. In this case I am using a 16 GB disk, so we can see a 14 GB detected (Windows uses formatted capacity which is less than physical) so I can see that disk 6 is indeed the one I want to work on.
A note of caution here, if you choose the wrong disk you can easily wipe a drive on your system, be careful and take the time to make sure you are selecting the correct drive.
Now that we have identified the disk we want to work on, again in this case Disk 6, we need to select it. Type “select disk #” in my example “select disk 6” to select it. This should be verified with a “Disk 6 is now the selected disk message as shown above.”
Next we type “clean” to erase all partition information and basically wipe the disk. Sometimes this step errors out, in that case simply type “clean” again. It usually will work the second time around.
Now we create a new primary partition with the “create partition primary” command, as shown above. Again this should be confirmed by a message indicating success.
We now select the newly created partition with the “select partition 1” command. This action is confirmed with a message.
Now we activate the partition by typing “active”. Then we format the drive for use, type the command “format quick fs=fat32” to format the drive. Note the similarity to the GUI opion as this is the same process. After a few seconds, or minutes depending on drive size, the program should show format completed.
Finally we can assign it a drive letter. By simply typing the command “assign” the system will automatically assign it a drive letter, it will usually be one later letter than original drive letter, as Windows thinks this is a new drive, so in my case we went from J to K as shown below.
Well that is pretty much it, I told you it was simple. We now have our USB Flash Drive back to factory default capacity, formatted, and ready for use.
An abbreviated list of the commands that were used are as follows:
- list disk
- select disk #
- create partition primary
- select partition 1
- format quick fs=fat32