Wipe the USB Drive Clean with Diskpart Command Line Tool. Windows comes with a built-in format disk option to erase everything from a USB flash drive. This is accessible from a simple right-click, but at this stage it probably won’t work. Don't be intimidated by the command line interface. I'm going to tell you exactly which commands to enter. Step 3: Use the diskutil command to identify which drive your USB is mounted on. Open Mac Spotlight using the ⌘ + space keyboard shortcut. Then type the word 'terminal' and select Terminal from the dropdown list. USB flash drives are the little stick-like devices that we carry along in our pockets as portable external storage. But these little devices pack quite a punch; they can double up as your mobile movie library, photo collection, backup drive, OS boot volume, or just a way to transfer stuff from one computer to another.
- Format A Thumb Drive Mac
- Format Thumb Drive Mac Os
- Format Flash Drive Mac Command Line
- How To Format Hard Drive For Mac
Formatting USB drives in Linux from the command line (terminal) is very easy.
In this note i will show how to format an external HDD, SSD or USB flash drive in Linux from the command line using mkfs
utility.
I will provide the examples of disk formatting to the most popular file system types: FAT32
, exFAT
, NTFS
, EXT4
, XFS
and will show how to list the all supported file systems.
Cool Tip: Check the real actual size of USB flash drive or SD card! Read More →
Format USB Drive in Linux
Execute the lsblk
command to identify the name of the partition on the USB drive you want to format:
In the example above, the USB drive is recognized by the operating system as a disk named /dev/sdb
with a single partition /dev/sdb1
mounted on /media/user/usb0
.
Unmount the USB drive if it is mounted:
Warning: Formatting the USB drive will cause the loose of data on it!
Format a USB drive to the desired format and create a label (optionally):
Format To | Command |
---|---|
FAT32 | |
exFAT | |
NTFS | |
EXT4 | |
XFS |
List all supported filesystem types:
Cool Tip: Test performance of HDD, SSD, USB Flash Drive, SD card! Read more →
Dec 16, 2020 • Filed to: USB Recovery • Proven solutions
A lot of Linux users find it hard to format USB drives due to the restricted environment of the OS. Although Linux offers tons of advantages, it can be a bit tedious to work on at times. So, is there any feasible solution to format a USB drive in Linux? If you are thinking the same thing, then today is your lucky day – as you have come to the right place.
Today I'm here to help you solve this problem and format flash drive in Linux in two different ways. Apart from that, the guide has also included a quick solution to recover accidentally deleted data from a USB drive.
Part 1: How to Format a USB Flash Drive in Linux?
You might already know that Linux is one of the most widely used open-source operating systems in the world. While Linux is a kernel, it is presented through different distribution systems like Ubuntu, Fedora, Debian, and so on. Therefore, the GUI solution to format a pen drive in Linux would depend on its distribution system. Apart from that, you can also take the assistance of certain commands to access and format a USB drive in Linux. Let's discuss both of these solutions in detail.
Solution 1: Format USB Drive via Terminal (Command Prompt)
Terminal or Command Prompt is one of the most vital components in any operating system that lets us communicate with it via a command-line interface. Therefore, it doesn't matter if you run a Fedora or Ubuntu, you can take the assistance of certain commands to format a USB stick in Linux.
Step 1: Launch Terminal on your Linux system
There are different ways to launch Terminal on Linux. Firstly, you can just press the Ctrl + Alt + T keys at the same time to launch the Terminal window. Gnome users can also find it under Applications > Accessories. Also, you can go to the Dash widget on the GUI and search for 'terminal' as well.
Step 2: Identify the attached USB drive
Now, attach your USB drive to the system and let it detect it. To know its identifier, you can enter the '$ df' command. This will display a list of the connected media and disks with their details. For instance, in this case, it is identified as '/dev/sdc1'.
Step 3: Unmount the disk
When a USB drive is first attached to a Linux system, it is automatically mounted. To format the flash drive in Linux, we need to unmount it first. To do this, you have to enter the 'unmount' command, following by the identifier. In our case, we will enter the command: $ sudo umount /dev/sdc1
Format A Thumb Drive Mac
Step 4: Format the USB drive
Now, you can just format the USB drive in Linux by entering the 'mkfs' command. It will have a parameter that will decide the file system on the drive. Mostly, NTFS or FAT32 is recommended due to its compatibility with Windows. Here are the common possible ways to write it:
- For the vFAT (FAT32) file system: sudo mkfs.vfat /dev/sdc1
- For NTFS file system: sudo mkfs.ntfs /dev/sdc1
- For the EXT4 file system: sudo mkfs.ext4 /dev/sdc1
Please note that the '/dev/sdc1' identifier can be replaced by the one in your Linux system for the connected USB drive.
Solution 2: Format USB Drive via the Disks Utility
If you have an advanced layer of Ubuntu or Fedora over the Linux kernel, then you can also use its graphic user interface to format a USB drive. For instance, Ubuntu systems come with an inbuilt utility program known as 'Disks'. To learn how to format a USB drive in Linux via its GUI, follow these steps:
1. Firstly, access the Disks Utility on your system. To do this, click on the Dash option on Ubuntu on the top-right corner. Make sure that the USB drive that you wish to format is connected to the system beforehand.
2. Type 'Disks' on the Dash search and when the relevant result is displayed, click on the icon to open it. You can also find the Disks Utility under its Applications as well.
3. This will launch the Disks Utility interface on the system. On the left panel, you can view the available internal and external storage sources. From here, select the connected thumb drive.
4. On the right, this will display various details of the USB drive. Click on the gear icon to visit its settings.
5. This will launch a dedicated window for formatting the disk. Select the file format and the type of formatting. You can also give the disk a new name as well. Once you are done, click on the 'Format' button and wait as Linux would format the USB drive.
Part 2: How to Recover Files from Formatted USB Drive in Linux?
There are times when users end up formatting a USB drive in Linux by mistake. To resolve this and get back your formatted data, you can take the assistance of a data recovery tool. For instance, Wondershare Recoverit is one of the most trusted and effective data recovery applications for Windows and Mac. If you have formatted a USB drive accidentally on Linux, then unmount it first, and connect it to a Windows or Mac. Later, you can take the assistance of Recoverit to extract all kinds of lost or deleted content from it.
Video: How to Recover Lost Data
The application supports all sorts of USB drives with every major file format. The interface is also extremely user-friendly with an option to preview the data before restoring it. Here's how you can perform data recovery on a formatted USB drive using Recoverit.
Step 1: Connect the USB drive and select it
Firstly, disconnect the formatted drive from the Linux system and connect it to the Windows or Mac system on which Recoverit is installed. Launch Recoverit and check that the connected USB drive has been detected by it. Select its icon and click on the 'Start' button to scan it.
Step 2: Wait for the scan to be over
Format Thumb Drive Mac Os
As Recoverit would scan the connected USB drive, you can wait for it to be completed. Although, you can pause the process in between and even preview its results as well.
Step 3: Restore your data
Format Flash Drive Mac Command Line
How To Format Hard Drive For Mac
In the end, you can just preview the extracted content like photos, videos, documents, etc. on Recoverit. Select the files you wish to get back and click on the 'Recover' button to save them on the location of your choice. Instead of restoring your data to the USB drive, prefer saving it on your system instead.
That's it! After reading this quick and informative guide, you would certainly be able to format the USB drive in Linux like a pro. As you can see, there are so many ways for Linux users to format a USB drive on their system. Apart from that, if you have accidentally formatted a pen drive, then recover your lost data with a tool like Recoverit. Go ahead and give its free version a try and share this guide with others to teach them how to format a pen drive in Linux as well.