I have a USB drive which I use for transferring files between my computers in the home. A few days ago, I used Ubuntu’s Disk utility to make a bootable USB stick for installing Ubuntu in a few systems. Ubuntu installed fine on every PC that I tried.
Everything went fine until I inserted the USB drive into my Windows PC.
Out of the 32Ggigs, the USB drive was showing up as a single 4GB logical partition in “My PC”. I checked the Disk Management in Windows to see if the drive was screwed for good or not. Turns out that it was partitioned into 4 pieces by the Ubuntu disk utility. When I tried to format the drive using the normal right-click > Format method, I got the error that “Windows was unable to complete the format.”
So, the USB drive was now a meager 4GB along with no option to change its state. Initially, I thought that it was gone for good. However, upon digging deeper into Windows Diskpart, I was able to recover the drive easily.
The problem with the drive was that Ubuntu’s disk utility had split the drive into 3 logical partitions. This method was obscure to Windows, so the formatting was not possible. Here’s how I fixed it.
Delete partitions from a USB/pen drive with diskpart
- Insert the USB drive into one of the ports on your PC and wait for it to show up in This PC/ My Computer.
- Press Windows key and search for
cmd. Select the Command Prompt from the results. Right-click on command prompt and select “Run as administrator“.
- In the cmd window, type
diskpart. The diskpart is a utility in which allows you to manage disks and their partitions in Windows.
list disk. This will show all the drives connected to your PC. In my case, it is Disk 2 of size 30GB.
- Now type
select disk X. Here X is the number which your USB drive has been assigned by diskpart. In my PC, it is 2. So, I will have to type
select disk 2as shown in the image below.
cleanto clear the partition data from the selected drive. The
cleancommand will remove all the currently present partitions in the drive without you worrying about each of them. Alternatively, you can also use the
delete partitioncommands to delete the partitions one by one.
- All the data from the drive is now removed and there are no formatted partitions in it. In order to use it for storage, you need to create partitions. For this, type
create partition primaryand press enter. This command will create a single partition on the USB drive using all the available storage.
- Now, we need to assign this partition as the primary one. For this, type
select partition 1and press enter.
activeto make this partition the default.
- Use the
format fs=ntfs quickcommand to quick format the drive.
- Lastly, type
assignto allow Windows to give the drive a single letter name for listing it in “This PC”/My Computer.
exitto exit the diskpart utility.
Close everything and press Windows key + E to open “This PC”/”My computer”. You will now see the full sized USB drive on your PC.