Introduction
Occasionally, it is necessary to format the USB drive (for example, when changing the file system or deleting data). However, many Linux users are afraid to start the formatting process, thinking it is either a very complicated or time-consuming task.
In this tutorial, you will learn how to format the USB drive in Linux using three quick and simple methods:
- Terminal
- Disk Utility
- GParted tool
Prerequisites
- A system running Linux
- A USB drive
- Access to the terminal/command line
- A user account with sudo/root privileges
Which File System to Use for USB Formatting?
There are many file systems in use, differing by maximum file size and operating system compatibility. The most commonly used file systems when formatting a USB drive are:
- FAT32
- NTFS
- exFAT
Their main features and differences are:
File System | Supported File Size | Compatibility | Ideal Usage |
FAT32 | up to 4 GB | Windows, Mac, Linux | For maximum compatibility |
NTFS | 16 EiB – 1 KB | Windows, Mac (read-only), most Linux distributions | For internal drives and Windows system files |
exFAT | 16 EiB – 1 KB | Windows, Mac, Linux (requires extra drivers to access) | For files larger than 4 GB |
Method 1: Format USB Using the Terminal
The easiest and fastest way to format a USB drive in Linux is through the terminal. The procedure consists of three steps:
- Locating the USB drive.
- Unmounting and formatting the USB drive.
- Verifying the process was successful.
Follow the instructions below to format a USB drive using the terminal.
Step 1: Locate USB Drive
Open the terminal and run the following command:
df
The terminal prints out a list of all mounted partitions and relevant information: used space, available space, used space percentage, and the path.
Locate the USB in the list and find the corresponding device. In this example, the USB drive is /dev/sdb1
.
Note: If you are unsure of the drive designation, unplug the USB drive temporarily before running the df
command again. The device that is now gone from the list is your USB device.
Step 2: Unmount and Format USB Drive
Unmount the USB drives before formatting. To do so, run this command:
sudo umount /dev/sdb1
After unmounting, format the USB drive using the preferred file system (replace sdb1
with the name of your device):
- To format a USB drive with FAT32 file system, use:
sudo mkfs.vfat /dev/sdb1
- To format a USB drive using the NTFS file system run:
sudo mkfs.ntfs /dev/sdb1
- To format a USB drive in accordance with the exFAT file system use:
sudo mkfs.exfat /dev/sdb1
Step 3: Verify USB Drive Formatting
Confirm the formatting process has completed successfully:
sudo fsck /dev/sdb1
A USB drive with no files indicates successful formatting.
Method 2: Format USB Using Disk Utility
The GNOME Disk Utility is a graphical tool for partitioning and formatting storage drives in Linux.
Follow the outlined steps to format a USB drive using the Disk Utility tool.
Step 1: Open Disk Utility
To open the Disk Utility:
- Launch the Application menu.
- Type “disk” in the search bar.
- Click the Disks icon.
Step 2: Identify the USB Drive
Locate the USB drive from the left pane and select it. The right pane contains details about the drive, such as model name, size, serial number, and contents.
Step 3: Format the USB Drive
1. Click the gear icon and select the Format Partition option from the drop-down menu.
2. Type the preferred name for the USB drive.
Optionally, enable the Erase option to overwrite the existing data from the USB drive. Choose the file system format and click on the Next button.
3. A pop-up appears with a warning message about data deletion and formatting details. Start the formatting process by clicking the Format button.
4. The progress line displays the remaining time until the formatting process completes. Close the Disk Utility when the job completes.
Method 3: Format USB Using GParted Tool
Formatting via GParted takes the most time as it involves an additional step – installing the tool. However, it is a handy tool that you can use even after you have finished formatting the USB drive.
Follow the steps below to format a USB drive using the GParted tool.
Step 1: Install GParted Tool
1. Open the terminal and install the GParted tool using this command:
sudo apt install gparted
Confirm the installation by pressing y
and then hit Enter. Wait until the process completes.
2. Run the GParted tool with:
sudo gparted
The terminal loads the GParted home screen.
Step 2: Start the Formatting Process
1. Select the /dev/sdb option from the drop-down menu at the top of the GParted home screen.
2. Right-click the /dev/sdb1 partition and select Format to. Choose the preferred file system from the list to continue.
Step 3: Start the Process
1. Click the green checkmark button to apply all operations.
2. A pop-up appears with a warning message about data deletion. Click Apply to continue.
The GParted formats the drive. The time required for the formatting process varies depending on the size and type of the USB drive.
3. Click the Close button to exit the menu when the operation completes.
Conclusion
In this article, you learned how to format a USB drive in Linux using several methods. Additionally, we went through the main features and differences between the three most commonly used file systems.
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/223776.html