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!
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.
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
- 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 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
Here you can notice that despite having multiple logical partitions, it shows the disk as a single physical drive.
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
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.
Create Single large partition
Creates a single partition with maximum available space.
create partition primary
Optionally, if your OS doesn’t automatically do so you might want to format the drive before you can use it.
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.
Great article, thx!