Delete unwanted Partitions to Free up Space on USB drive using Diskpart on Windows

Updated on April 17, 2020

Junk Partitions on USB drive - diskpart

Have you ever faced the situation where you plug in your pen drive to your computer and find out that there’s more than one new device found? On closer inspection, you find out that it’s the same pen drive, but there are somehow two partitions on it! If you try to remember how this might have happened you’ll probably recollect using it as a bootable disk sometime recently, maybe to install Kali onto your testing laptop? Or maybe to upgrade a rusty old PC to the latest version of windows? Whatever it may be, you’re now stuck with a flash drive with multiple partitions. You might even see that there’s a lot less space there, even in total as there might be some unallocated space too. Depending on the size of the partitioning, you now can’t store a large file on the drive – one that’s well within the size of the overall disk because there’s a logical partition that’s preventing you from doing so!

partitions on usb drive

What’s worse? The two partitions will be treated as separate logical drives and thanks to this you can’t just undo this by formatting the disk. That’s the length one would usually think up to before Googling about the problem at hand. Well, we’re here to help.

There are dozens of utilities out there both free and premium that can do this task for you but none of them is as versatile, powerful and as simple as Diskpart! The best thing yet is that it’s a command-line tool baked into Windows itself! Windows also has a built-in tool with a nifty GUI and everything for managing simple operations with regard to simple operations on disks but it is slow and tends to malfunction once there’s more than one logical drive involved on a single external drive and doesn’t let you delete the entire volume on the USB drive unless you wipe all partitions, leading us to pick Diskpart. It’s a more advanced solution so we’re placing the disclaimer right here.

Disclaimer:

Fiddling around with disk partitions can end up wiping storages you do not intend to wipe, maybe even the main storage if you are not careful enough, so please exercise caution while doing so.

  • This will wipe all data on the USB device so create backups if any are needed.
  • We would also suggest unplugging all other external drives that you’d currently consider unnecessary to avoid confusion.

We’ve emulated the problem at hand by manually creating two partitions of unequal sizes. Now here are the steps to revert your device back to a single partitioned state and free up all your lost disk space.

Launching Diskpart

  • Open ‘run’ app from the start menu or by pressing Win + R

Launch diskpart on windows

  • Type ‘diskpart’ and press Enter. You will need to confirm allowing Admin Permissions for it to run. This opens up diskpart.

You can also open diskpart by typing diskpart in an elevated command prompt. You can open an elevated command prompt by pressing Win+X and selecting “Command Prompt(Admin)”

Diskpart command prompt on windows

Diskpart Commands to wipe unnecessary partitions

List disk drives

This should enlist all disk drives connected to your computer, including all HDDs, SSDs and pen drives connected.

list disk

diskpart command to list disks

Here you can notice that despite having multiple logical partitions, it shows the disk as a single physical drive.

Note down the number of your pen drive. Knowing the storage space of it helps identify it.

Select disk drive

Replace x here with the number of the device that you just noted. It selects that device for further operation.

select disk x

select disk drive command diskpart

For additional confirmation you can view all logical partitions on the drive by typing in list partition

Clean disk drive

This wipes all data and removes all partitions and if you check, the logical drives connected are now not seen.

diskpart clean partition

Create Single large partition

Creates a single partition with maximum available space.

create partition primary

creatcreate single large partition diskparte single large partition diskpart

Optionally, if your OS doesn’t automatically do so you might want to format the drive before you can use it.

Single partition on usb

To learn more about how diskpart functions and how it is better than the Disk Management tool in Windows, you can visit its official documentation on Microsoft’s website here.

Was this article helpful?

Related Articles

Comments Leave a Comment

Leave a Comment