How To Fix A USB Drive After Linux Has Been Installed On It

Introduction

Here is the scenario. You have followed one of my guides for creating a Linux USB drive but not you want to use it again for a different purpose.

For whatever reason it only shows a small amount of disk space showing and it doesn’t show up in Windows Explorer.

What can you do to fix it?

This guide takes you through the steps to getting the full disk space back. Let me be clear though that at no point did Linux break the USB drive. It just repartitioned it so that it can boot on a computer with the UEFI boot loader.

USB Drive Not Showing Up In Explorer

I have plugged in a USB drive with Linux installed on it and as you can see it is not showing up in Explorer.

To troubleshoot this issue the first thing you need to do is find out if the USB drive is visible to Windows at all and you can do that by using the Disk Management tool.

Right click in the bottom left corner and choose “Disk Management” from the menu.

As you can see from the image above, the disk management tool has picked up 2 disks. Disk 0 is my hard drive and disk 1 is my USB drive.

You can also see that Disk 1 is 7.45 gigabytes in size. You will also notice that it is partitioned into 2 parts. The first partition is a 30 megabyte EFI partition and the second is 7.42 gigabytes of unpartitioned space. This may be slightly different depending on the distribution you installed on the USB drive.

Ideally you would like to delete the first partition or expand it into the second partition and change the partition type to a primary partition.

Right clicking the EFI partition though blanks out all of the options.

Unfortunately, you won’t be able to do anything with that EFI partition and that is why you think the drive is broken because you will have a small partition or no partition at all available to you.

Coming next is the way to fix this problem.

How To Fix A USB Drive Using Diskpart

Right click on the start button in the bottom left corner and choose “Command Prompt Admin”.

The first thing to do is run diskpart. To do this simply type the following:

diskpart

Now you need to list the disks available to you:

list disk

This will bring up a list of disks. You now need to select the one that goes with your USB drive. To identify it look at the size of the disk. It will be the same as the disk listed in the Disk Management tool.

Type the following to select the disk:

select disk 1

(Replace disk 1 with the number of the disk for your USB drive, i.e. select disk 1, select disk 2, etc).

Now you need to list all of the partitions on the USB drive.

list partition

In my case there was only 1 partition but you may have more than one partition. For each partition that you see listed type the following 2 commands:

select partition 1

delete partition

Replace partition 1 with the name of the partition listed in list partition. After following the commands run the list partition again to see the partition numbers.

When there are no more partitions you can stop.

Finally you need to create 1 more new partition. To do this type the following:

create partition primary

Your USB drive now has a single primary partition again.

Formatting Your USB Drive

 

 

 

 

 

 

 

 

 

 

Run the Disk Management tool again by right clicking on the start button and choosing “Disk Management”.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

As you can disk 1 now shows 7.45 gigabytes but it is a RAW partition and not really usable in this state. Right click on the disk 1 and choose format.

You can now give the USB drive a label and choose a file system. I recommend FAT32 for a USB drive as it is the most supported file system across multiple architectures.

Click “OK” to format the USB drive.

A message will appear stating that you will lose all data on the USB drive. Click “OK” because you already did that when you started deleting partitions.

At this point within Explorer you should be able to see your USB drive. If it doesn’t show up, right click on the partition within Disk Management and choose “Change Drive Letter And Paths”.

Click on the “Add” button and choose a drive letter to associate with this USB drive.

Your USB drive should now be fixed.

Thanks for reading.

5 Comments

Leave a Reply