How to Format Your USB Drive on Linux
Formatting your USB drive on Linux can be a tricky task if you’re not familiar with the process. But with the right guidance, it’s a quick and easy procedure.
Before formatting your USB drive, make sure that you have saved a backup of any important data that is stored in the device because formatting will erase any data in the drive. In this article, we will walk you through the process of formatting a USB drive on Linux.
Step 1: Identifying your USB drive
The first step is to identify the specific name of your USB drive. To do this, open the terminal and type in the following command:
$ sudo fdisk -l
This command will display all the disks connected to your system, including the USB drive. Note down the name of the USB drive. It usually starts with /dev/sd and then is followed by a letter.
Step 2: Unmounting the USB drive
Once the drive has been identified, you will need to unmount it before formatting it. To unmount the USB drive, type the following command in the terminal:
$ sudo umount /dev/sdx1
Replace sdx1 with the name of your USB drive.
Step 3: Formatting the USB drive
To format the USB drive on Linux, you can use the mkfs command. This command is used to create file systems on a Linux system. The following command can be used to format your USB drive:
$ sudo mkfs -t vfat /dev/sdx1
Here, we have used the FAT file system, which is widely supported by various operating systems, including Windows, Mac, and Linux.
Step 4: Verifying the formatting process
After executing the previous command, the USB drive will be formatted, and you can verify it by typing the following command:
$ sudo fdisk -l
This will display a list of all the drives connected to your system, including the USB drive, displaying the new partition table of your USB device.
Step 5: Ejecting the USB drive
Finally, to ensure the safety of your data, make sure that you safely eject your USB drive before removing it. To do this, execute the following command in the terminal:
$ sudo eject /dev/sdx1
Replace ‘sdx1’ with the name given to your USB drive.