Formatting a USB drive is a common operation on most computer systems and can come in handy in a variety of ways. For example, you can format a USB drive if it is infected with a virus and the data is corrupted, or you want to change the file system because it is incompatible with your OS. Likewise, it can be useful if you want to completely erase old data so that you can make full use of your storage space. So, whatever the reason, you can easily format a USB device in various ways on Debian operating system.
In this article, I will show you the different methods to format a USB stick on the command line and on the Debian desktop. You can use any of them depending on your preference.
Please note that we have followed the commands and procedure mentioned in this article on a Debian 10 system.
Format your USB stick in command line
To format USB via command line, follow the procedure outlined here:
1. When you plug in a USB drive, Linux adds the device to the / dev directory. So, our first step would be to figure out the correct name for the USB stick to avoid formatting any other device by mistake.
Open Terminal by pressing the super key on your keyboard and search for it using the search bar at the top. In Terminal, enter the following command:
$ df –h
Most likely a USB stick will appear at the end of the output. As in our output, the USB stick appears as / dev / sdb1.
2. Now that you have determined the device name, please disconnect the device first, otherwise you will not be able to format it. Run the following command in terminal to disconnect the USB device.
$ sudo umount /dev/sdb1
Be sure to replace / dev / sdb1 with the drive name obtained with the df -h command.
3. Run the following command in Terminal to format the USB drive according to the VFAT file system:
$ sudo mkfs.vfat /dev/sdb1
If you want to format your USB stick as ntfs or ext3, you can do so simply by replacing vfat in the above command with the desired filesystem.
Your USB stick will be successfully formatted with the file system you specified.
GUI method for formatting USB stick
To format USB via GUI, there are two different ways:
Format directly from the file manager
In this method, we will format the USB stick using the Debian file manager.
Open the file manager on your Debian system. Then right-click the USB drive and select Format option from the menu.
AND Format volume a dialog box will open. at Volume name enter the name of the USB drive in the field; this will be a new shortcut for your USB stick. Turn on Erase button if you want to erase existing data on your system. When using this option, all your existing data will be overwritten and the process will take a little longer. Also select the file system type. Then press the button following button located in the upper right corner.
The following confirmation dialog will appear. Confirm the information to avoid formatting the wrong storage by mistake. Then press the button Format button.
Your USB drive will be successfully formatted based on the file system you specified and you will see your USB drive in the file manager with a new label.
Format your USB stick with GParted tool
Gparted is an open source utility on Linux systems that can be used to format USB drives. Following is the procedure for installing and using this tool:
1. Run the following command in Terminal to install the Gparted utility:
$ sudo apt-get install GParted
The system may offer a Yes / No option to continue the installation procedure. Hit Y and then To come in to continue, after that Gparted will be installed on your system.
Formatting the USB stick
2. Run the Gparted utility by pressing the super-key on your keyboard and searching the search bar. Then, in the results, click the Gparted utility to open it.
3. You will need to enter the root password for authentication, since only the root user can run the Gparted utility. Enter your password and click Authenticate button.
4. When the utility starts, the hard disk partition / dev / sda is displayed by default. To view the details of your USB drive, select it from the dropdown located in the upper right corner as shown in the following screenshot.
After you select the USB drive, you can see its details in the Gparted window.
5. Before formatting the USB stick, you must first unplug it. In the Gparted utility, right click on the USB partition you want to format and select Unmount option.
5. The USB stick is now ready to format. Right click on the USB partition in the Gpated utility and select Format to option. Under Format to option, you will see several file system options. Select the type of file system you want to use for your USB storage.
You will see the added operation pending in the lower left corner of the Gparted utility.
6. Now, to apply this operation, click the icon Use button on the toolbar.
7. You will now be prompted to confirm the operation as all your data on the USB stick will be formatted. After making sure you are sure, press the button Use button.
8. The formatting operation will begin and your USB drive will be formatted according to the file system you specified.
You will receive the following notification after the formatting process is complete.
Click the icon Close button to return to the main Gparted window.
That’s all! In this article, we discussed both the graphical interface and how to format a USB drive using the command line. By following any of the above methods, you can easily erase data from your USB device for better use.
How to format a USB stick in Debian