- How to Format USB Drive in Linux | 2 Working Solutions
- Can’t seem to format USB drive in Linux even after numerous attempts? Read this guide to learn 2 working solutions on how to format a pen drive in Linux like a pro.
- Part 1: How to Format a USB Flash Drive in Linux?
- Solution 1: Format USB Drive via Terminal (Command Prompt)
- Solution 2: Format USB Drive via the Disks Utility
- Part 2: How to Recover Files from Formatted USB Drive in Linux?
- Video: How to Recover Lost Data
- Как отформатировать флешку в терминале
- How To Format USB Drive in Linux Command Line
- Step 1 – Attach USB to System
- Step 2 – Format USB Drive in Linux
- Conclusion
- How to Format USB Drive on Linux
- Method 2: Format USB Drive Through The Disks Utility
- About the author
- Zeeman Memon
How to Format USB Drive in Linux | 2 Working Solutions
Can’t seem to format USB drive in Linux even after numerous attempts? Read this guide to learn 2 working solutions on how to format a pen drive in Linux like a pro.
Sue Wayne
Sep 08, 2021 • Filed to: USB Recovery • Proven solutions
Are you frustrated by not able 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
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
Recent Videos from Recoverit
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
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
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.
Источник
Как отформатировать флешку в терминале
Все мы время от времени форматируем свои флешки или внешние жесткие диски. Но как это лучше сделать? В графическом интерфейсе или в терминале?
Я считаю, что форматировать флешки очень удобно в терминале. Сегодня я хочу показать вам, как это делается. Все, что нужно для этого руководства — флешка или внешний жесткий диск, объем значения не имеет.
1. Вставьте флешку в компьютер.
2. Откройте терминал(CTRL + ALT + T).
3. Найдите USB-устройство, которое вы хотите отформатировать, с помощью команды:
Приведенная выше команда выведет список всех дисков и пути к ним. Найдите свое устройство, предназначенное для форматирования.
Имя диска, который я использую в этом руководстве — Seth, а путь к нему в файловой системе /dev/sdc1.
3. Отмонтируйте диск с помощью команды:
4. Теперь запустим форматирование в файловую систему fat32:
Разберем вышеприведенную команду.
Команда mkfs используется в Linux для создания файловой системы на устройстве, обычно на разделе диска. Аргумент device может задавать имя устройства (например /dev/sdb2), или имя файла, который может содержать файловую систему. Аргумент size — это количество блоков, используемое под файловую систему.
Форматирует файловую систему в FAT32, доступны также другие форматы: mkfs.bfs, mkfs.ext2, mkfs.ext3, mkfs.ext4, mkfs.minix, mkfs.msdos, mkfs.vfat, mkfs.xfs, mkfs.xiafs и так далее.
Volume-name задает имя (метку) для файловой системы. Имя раздела может быть до 11 символов длиной. По умолчанию метка не создается. В моем случае имя раздела «Ubuntu».
Обычно жесткие диски разбиваются таким образом по умолчанию. Вы запрещаете создавать файловую систему на всем устройсте.
Запустив $ df после форматирования, вы увидите:
Источник
How To Format USB Drive in Linux Command Line
USB formatting is the process of erasing all data from the disk and prepare it for use. Sometimes we are required to change the filesystem on our USB drive, In that case, we have to format the USB drive with the new filesystem type. Formatting a USB drive in Ubuntu using Terminal commands is much easier than formatting it in Windows systems.
This tutorial will help Ubuntu (Linux) users with the simple steps for format a USB flash drive using the command line.
Step 1 – Attach USB to System
Insert a USB drive into your system and identify your USB drive correctly. This is the step you need to take care, because you may format the wrong disk if not correctly identify your disk.
Now, You can see that the USD drive is attached as /dev/sdc1 device. Which is mounted on /media/tecadmin.
Step 2 – Format USB Drive in Linux
Whenever we attach a USB drive in Ubuntu, it is automatically mounted to the system. We can not format any disk on Linux systems that are already mounted. So first un-mount /dev/sdc1 USB drive on your system.
Now, Use one of the following commands as per the file system you want. To format a USB drive, most of the users prefer VFAT and NTFS file systems because they can be easily used on the Windows operating system.
- Format with vFat File System
- Format with NTFS File System
- Format with EXT4 File System
Similarly, you can format a USB Flash drive with any required file system.
Conclusion
In this tutorial, you have learned to format a USB drive on a Linux system via the command-line interface.
Источник
How to Format USB Drive on Linux
To access the terminal, you must first open the Ubuntu Dash. This is where all Ubuntu software is accessible from. Once inside the Dash (located on the bottom left corner of the screen in the form of a “Show Applications” icon, ), type “terminal” in the search bar and click on the application of the Terminal that appears.
Use the keyboard shortcut which is Ctrl+Alt+T. If you are not familiar with keyboard shortcuts, they are the shortest way of performing an operation. Simply hold these three keys together and the Terminal application will open.
A new terminal window will open. Type the command “ df ” and press enter.
df returns a list of the details of all the partitions mounted to your device including the total space in each partition, the used space, and the available space.
From this list, locate your USB drive partition. A way to do that is to read the path of your partition from the Linux file manager and then search for that path in the list of partitions which came up in df.
As you can see, my USB drive partition is mounted on media/kausar/83F3-F8C7 and the corresponding Filesystem name which comes up under df is / dev / sdc1.
Therefore, the next command I will type is “ sudo umount / dev / sdc1” . This command will unmount the USB drive partition from the device. Enter your Linux password and press enter.
The next and final (phew!) step is to format the USB drive. This is done with the command “ sudo mkfs.vfat / dev / sdc1”. Note: This command formats the drive with the FAT32 format file system.
All done! To check if the USB drive has been formatted correctly, head on over to the file manager and open the USB drive. If it is empty, it has been formatted.
Method 2: Format USB Drive Through The Disks Utility
To access the Disks utility, navigate to the Dash icon (most probably located on the bottom left corner of the screen in the form of a “Show Applications” icon, , or as a Ubuntu icon). The Ubuntu Dash holds all the Ubuntu software available and installed on your device.
Type “Disks” in the resulting search bar and click on the Disks application that comes up.
It will open up in a new window. Locate your USB drive in the list of which appear in the left panel and click on it.
Next, under “Volumes”, of the three icons you see, click on the third gear icon, . A dropdown menu will appear. From the options displayed, click on “Format Partition”.
Set the name of your USB drive and select which type of file system format to format your USB to. Then select “Next”. A warning will pop up asking you to confirm the deletion of all your data in the USB drive. Select “Format” displayed in red on the top right corner to proceed with the formatting.
And that’s it. You’re done. These are the two easiest ways to format your USB drive and make it 100% available in space.
There are other methods of formatting a USB drive on Linux as well. For example, you can download a software called “GParted” from Ubuntu Software or the CLI. In case you experience trouble using the two methods described above, GParted offers a simple GUI to format USB drives and is an overall useful tool to have.
About the author
Zeeman Memon
Hi there! I’m a Software Engineer by degree, Blogger by skills who loves to write about tech, develop websites & do SEO. You can reach out to me on LinkedIn.
Источник