DiskPart: Format A Thumb Drive With The Windows Command Line To Restore The Full Size

Windows has a GUI tool called Disk Management, but it seems limited in being able delete partitions or combine them to restore the full space of the drive. This is a common problem when trying to restore a thumb drive previously used to install an OS, such as that time you tried Ubuntu, because some changes were made to it to make it bootable. To move forward, we’re going to use a command line program called DiskPart.

First, open Command Prompt as an administrator.

Type diskpart to run the disk partitioning program.

In the DISKPART program, type list disk to get a list of drives so you can find the correct disk number to work on.

My thumb drive I want to format is Disk 3. As you can see, not all of the space is free despite formatting it with Disk Management and the normal “right click on drive letter in explorer” format option. This is because there are multiple partitions and unallocated space. So I type select disk 3 .

Now that a disk has been selected, type clean . This will make all of the space available.

Test to see that it worked by typing list disk

That’s better! But since we cleaned it, it’s all unallocated space now. So we need to do a few more things to let it work under a drive letter again. First, let’s create a partition with the command create partition primary .

Now we need to select the proper volume. First type list volume to find the correct one.

It looks like volume 8 is the right one. Notice how it says “RAW” for the file system? That’s a problem. I can select it by typing select volume 8 .

Finally, do a quick format by typing format quick .

After typing this command, your computer should act like you just plugged in the thumb drive, probably popping open the folder of the drive letter. If I were to do a list volume command again, I’ll see that the “RAW” file system changed to “FAT32”.

You could specify what file system you want by adding the FS modifier to the format command, such as format quick fs=ntfs . You can also customize the label of the drive so it might say something like “Scott’s Drive” instead of just “H:” or “New Volume” when you plug it in. Type help format for more info.