You have finally installed your Linux from a bootable USB flash drive. But there is an unexpected problem. Something happened to your flash drive. The flash drive just misbehaves and you do not know what to do. Do not get upset. This post will help you to format a bootable USB drive to normal. You can also use this method to recover any other USB flash drive which stopped working or does not work correctly
After installing Linux from a bootable USB, the USB drive is likely not to work correctly. For example, you copied some files there and they disappear or you can connect your flash drive to Linux but it does not work on Windows. This is due to incorrect partitioning when a bootable flag is added to a USB flash drive. However, it is easy to fix.
So, let us fix that problem.
1. Looking for the problem
Check the partitions of your USB drive
To show you where the problem is, I will open GNOME Disk Utility. You can use any other partition manager. For example, you can use KDE partition manager, Gparted or some of the command line utilities.
So, in Linux Mint and Ubuntu, GNOME Disk Utility is simply called Disks. Open it.
In the left panel, you can see all the hard drives.
My flash drive is a 16 Gb Samsung flash drive, which I have just used as a bootable USB flash drive to install Ubuntu or another Linux distribution.
What is the problem?
You can see that there is an Ubuntu image written to a drive. This is where the problem. Because this is a flash drive, normally it should have just one partition but when you write an ISO image to a flash drive it creates several partitions which are defined in the ISO image.
For example, in the case of Ubuntu, there are two partitions, and some free space left. This is not a normal configuration of a flash drive. That is why it is not recognized by many systems or it is recognized incorrectly.
This happens because it is a bootable USB flash drive it has a bootable flag. So, many systems will just see this flash drive as the drive with a bootable system not just as the flash drive to store information.
Do not worry it can be fixed very easily, you just need to run one simple command in the terminal and format your bootable USB to normal. But before you start doing that I would like to remind you that in Linux every hard drive has a specific name assigned to it.
Find the name of the device in Disks.
You can find it in the Disks program.
So, my flash drive has the name
Depending on how many drives you have in your system, your flash drive name can differ. The name can also change depending on the order you connect your drives. So, it is very important to check your USB flash drive name every time you are about to do anything with its file system.
Find the name of the device in the Terminal
You can also check it this name in the command line too. Just need to run this command:
sudo fdisk -l
You will see all the partitions of your system as output of this command. So, you need to find your flash drive based on its size. For example, I know that my flash drive is 15 Gbs so it has the name
2. Format a bootable USB to normal
Now that the problems have been identified, it is possible to start with the solution.
It basically consists of deleting the entire file system from the USB device and then formatting it with a new filesystem.
Wipe the filesystem from your flash drive
First, you need to completely wipe the filesystem from your flash drive to restore it to its original state. You run this command to wipe the filesystem from your flash drive:
sudo wipefs -all /dev/sdb
Note: You need to type the name of your flash drive here. So be very CAREFUL that you type the name correctly. Because if you wipe the filesystem of your main hard drive you may DESTROY your whole system.
Now, the filesystem has been wiped and the flash drive is completely clean. You can check that with:
sudo fdisk -l
You should see that the USB flash device has no partition. You need to create one.
For this there are two options, you can use the terminal or a graphical application. I will show you how to do it both ways.
Create the new partition using the command line
Let us first do the command-line way. For this, I will use the
cfdisk tool. So, you need to run this command:
sudo cfdisk /dev/sdb
Again, sdb is the name of my flash drive. Replace it with yours.
First, you need to select
dos option and press Enter.
Next, press Enter on the
new option to create a partition.
Next, you have to define the size. By default, it suggests creating the maximum possible size. So, this is what we want:
Then, select the
primary option to make the partition primary.
Now, apply the changes by selecting and pressing Enter on the Write option:
In the end, the program will ask you for confirmation. Type yes and press Enter.
After the program has finished the process, select
quit and press Enter to close the program.
Now, we have a flash drive with a new partition table.
Format the USB drive with FAT
We only need to format this partition with a file system that can be used cross-platform. The FAT filesystem is the most suitable for this purpose.
To do the formatting with FAT, run this command:
sudo mkfs.vfat -n 'ALU' /dev/sdb1
Let me explain the command briefly:
mkfs.vfatwill create a partition with FAT as the file system.
- ‘ALU’ is the label. You can replace it with whatever you prefer. It is optional.
/dev/sdb1is the device.
sdbis the name of the device but
sdb1refers to the first partition of that device.
Now, a bootable USB is formatted to normal and it is ready to use. Open the file manager, and you can write information into it. If you do not find it in the file manager, disconnect and connect your USB drive, it should appear in the left panel of your file manager after that.
And that is it. Your bootable USB is ready to work.
Create the partition using a graphical tool
Now I will teach you how to format a bootable USB to normal using a graphical tool. I recommend using the tool GParted. It is a well known and reliable program to manage partitions.
Note: If you have already done the steps above, you do not need to do these. I only show this as alternative to the command line way.
If you do not have GParted on your system, you can install it. It should be available in any Linux system. Just search for it in your software manager. So, open GParted:
Once the program has started, in the right corner you need to select your flash drive which is
sdb in my case.
And you see there is no allocated space in the device. So, go to the Device menu -> Create Partition Table.
msdos type. Then, apply the changes.
When the changes are finished, it is time to create the partition. To do this click with the right mouse button on the device and select the New option.
I will put the maximum space. For the file system, it is better to use the FAT file system because it is compatible with any system, for example, if you use Windows you can open without any problems. Next, you can give it a label too. So, you can use your name. Then, click on
So you just need to click on this icon and apply all the changes. It will take some time to reformat the flash drive.
If everything has finished successfully, you will see this image.
Testing the USB flash device
Now, your flash drive is ready for use. Open the file manager and try to create a new file in it with the right click of a mouse. Alternatively, you can simply copy some file to it.
After you placed some files on your flash drive disconnect and connect your flash drive. If the newly placed files are there, congratulations! Your flash drive is like new and can be used again.
One more solution to format a bootable USB to normal
If you did either of two ways to recover your device and it did not work for you, and your flash drive is still not recognized by your system or does not work correctly, there is one last thing you can try to format a bootable USB to normal.
First, make sure that your flash drive is not mounted:
sudo umount /dev/sdb1
sdb1 is for the partition name. After that, you can completely overwrite all the blocks of your flash drive with zeros. This will be kind of complete refreshment of your flash drive.
sudo dd if=/dev/zero of=/dev/sdb
In the unmount command, I used
sdb1 because it was a partition. But in this command, you do not need to specify any number, you need to provide the name of a drive, which is
Note: Again, make sure that this is the name of your flash drive. Also, writing zeros to a flash drive takes quite a lot of time. And if your flash drive is big it takes a really long time.
So, when everything is finished successfully and there were no errors, you can create a new partition table on your flash drive and format it with the FAT filesystem as I showed above. Hopefully, after that, your first drive will be working like a new one.
Now you know how to format a bootable USB to normal but you can use this method to recover any other USB flash drive which stopped working or does not work correctly most likely you will be able to restore this flash drive to its normal state and it will start working as a new.
You may also be interested in reading my post about encrypting a flash drive in Linux.