How to Format a Bootable USB to Normal
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
Content
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 sbd
.
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 sdb
.
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.vfat
will 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/sdb1
is the device.sdb
is the name of the device butsdb1
refers 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.
Select 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 Add
.
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.
3. 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
Remember, 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 sdb
.
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.
CONCLUSION
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.
Comments
Olaitan
this guide is truly helpful, my pendrive was able to work normal as before
Eleder
I’ve just recovered two bootable USBs following your very clear tutorial. Thank you so much for your help!
Piyush
Thanks for saving my money
Average Linux User
You are welcome! 🙂
Ansari Mohd Ali
Thank you soo sooo much. I was stuck using windows diskpart and disk management and even minitool partition wizard but neither of them worked. But your method works in one go Thank you so much. you have no idea how long i was finding the solution. you are awesome :)
ps - i am bookmarking this site
Average Linux User
Happy to hear it was helpful.
BTW, you can also subscribe to updates with email or RSS.
sundar
Thanks Procedure is written very well
Average Linux User
Thank you, Sundar!
aimme
It is very simple 1 - Go to Disks > Select The Disk from side pan (Not any partiotion) > Press Ctrl + F 2 - Format Disk window will appear. In the window for Erase select “Dont overwrite existing data(Qucik) and for partitioning select “Compatible with all systems and devices (MBR/DOS) 3 - Click format. and confirm. This will delete all the partitions in the disk. 4 - Select the Disk from side it will show the volumes information as free space. You need to create new partition to use the disk. 5 - Click the plus sign under the volumes information to add a partition set the Partition size, click next set volume name and select the type. No need to select Erase. Click the create button. That is it.
Average Linux User
Interesting… Thanks. I need to try this way.
Do you suggest that the trick is to use “Don’t overwrite existing data(Qucik)”? Does it the same as
wipefs
?BlindStevie
Thank you so much for all this information. It saved a flash drive for me. I very much appreciate your help.
Average Linux User
Happy to hear that. Thank you for your comment.
Seb
You might not see this but when I tried to clear it it says the drives in use by something else, I'm on ubuntu 16 and when i plug the USB in it shows 2 seperate drives, one of them connected to the other. the only apps open are firefox, discord and terminal
much appreciated
Arteia
I've got the same problem, how do I solve that?
Average Linux User
You need to make sure your USB is unmounted. If you have two partitions, you need to unmount them both. You can do though the system tray, in your file manager, or with
umount
:where
sdX
is your device name.Aca
My issue was fixed by the First step. In Disks, there were options to delete and create partitions. Don't know whether it is the correct method or not. But it worked lol.
Average Linux User
If it worked, it is fine too. Sometimes it doesn’t work, and one has to go a more complicated way.
Aryan Gaurav
Thanks for writing such a great tutorial.If your USB device shows as read only after performing the above operations in GParted then try running
killall nautilus
in terminal.It worked for me Read more at https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1021375Average Linux User
Thanks, for sharing your experience.
Saurabh
Very helpful.
Rhitansu Ghosal
I was stuck with an unformattable bootable pen drive. Initially, I used the terminal to format it. However, even after that, I was unable to mount the drive. I could solve the problem using Gparted as advised. Thank you.
Average Linux User
I am glad it helped. Thanks for the comment.
Wan Hatmi
I have same problem as u described. But my linux pc has been format to windows 10. Is there anyway I can format it in Windows 10? Have tried diskpart clean but no luck. Any solution? Thanks.
Víctor
Too many images that doesn´t MATCH with text :-)
Name
Thank you so much! You saved me from throwing my stick away!
Average Linux User
Thanks for the comment. I hope your re-covered USB stick will serve you many years.
Nadya
Thanks a lot for the info, it was helpful
Xaz
What happens if i use another computer running Windows 10, right click to USB drive on file explorer and select “Format” after installation of Ubuntu?
It works for Windows 10 bootable drive made by Rufus..
Xaz
Short answer, it works…