How to format a disk, a USB or an SD in Linux

If you’re just getting started on Linux, you’ve probably wondered how drives can be formatted on this operating system. The process to format drives in Linux is similar both from the graphical interface and using the command line, however, they are not exactly the same.

Regardless of the Linux distribution that we use, Ubuntu, Debian or any other, the process is practically the same, both from the graphical interface and using the command line. But, first of all, we must study what file system we want to use.

How to format a disk, a USB or an SD in Linux

Choose the file system

Windows 10 and Windows 11, like previous versions of the Microsoft operating system, allow us to format the drives using 3 different file systems: exFAT, FAT32 and NTFS. However, when it comes to a storage drive, Windows always encourages us to use NFTS as it lacks the limitations of FAT32 and is much faster than exFAT.

However, Linux uses another file system, a file system that is also not supported from Windows , so we cannot access Linux-formatted drives from Windows. Not natively, at least, but using third-party applications or with WSL, but only using terminal commands, since at the moment Microsoft still does not offer a graphical interface to use Linux.

Linux uses three different file systems: ext2, ext3, and ext4. The latter, ext4, is the format used by the most modern distributions and compatible with the most current equipment, while the other file systems are used in older distros and equipment. Unlike Windows, which is not able to read drives with ext2, ext3 and ext4 file systems, Linux is able to access and modify files on drives with exFAT, FAT32 and NTFS file systems.

As each Windows file system has its own limitations, the first thing we must do is choose which file format to choose:

  • FAT32 does not allow storing files larger than 4 GB
  • exFAT is the most compatible format for all operating systems and does not have the maximum file limitation of 4 GB.
  • NTFS is the file system used by Windows on drives where the operating system is installed.

As I have mentioned above, exFAT is the file format that we must use if we want the drive or hard disk to be formatted to be able to be read without problems both in Linux operating systems and through Windows without being forced to use a third-party application or Windows WSL.

The features offered by the exFAT file system are very similar to those currently offered by ext4 . Furthermore, it is also compatible with older Linux distributions that use the ext2 and ext3 file system. Once we are clear that the format to use is exFAT, the time has come to know the steps to follow to format drives in Linux.

The steps are exactly the same regardless of whether it is a hard drive, USB drive, or memory card.

How to Format Drives in Linux

Now that we are clear about the file system to use, the first thing we must do is identify the drive from Linux . Unlike Windows, where drives start with letters, Linux is a bit more complicated.

In Windows, the main drive running the operating system is drive C. If the main drive also has other partitions or hard drives, the drives will be D, E, and so on.

On Linux distributions, the main drive of the computer is sda. All partitions that are the primary drive include an additional number: sda1, sda2, sd3, and so on.

If we connect another drive to a Linux machine, it will be called sdb. If we connect a third, it will be sdc. If the second drive, sdb, has two partitions, these will be sdb1 and sdb2. If the third drive has 4 partitions, we will recognize them as sdc1, sdc2, sdc3 and sdc4.

As in Windows, Linux also does not allow us to format the main drive C and sda respectively from the system itself. To do this, we have to use the Windows installation wizard and a LiveCD distribution on Linux.

With the graphical interface

The fastest and easiest method to format drives in Linux is by using the graphical interface, specifically the Disks application, an application included in most modern Linux distributions.

With the Discs app

As soon as you open the application, it is divided into two columns. In the left column, all drives accessible from the computer are displayed. Here we must click on the unit that we want to format and, then, we go to the column on the right.

If the unit does not have any partition created, it is the first thing we must do by pressing the + sign and establishing the size that we want the partition to have and click on next. Next, in the Type section, we select exFAT. If it does not appear, click on Other and select the exFAT. Finally, click on Create and wait for the process to finish.

Formatear unidades Linux

If within the Other options, we cannot select the exFAT option, we need to install utils and fuse packages from the command line using the command:

sudo apt-get install exfat-fuse exfat-utils

Once we install, we return to the graphical interface and, this time, if we are going to be able to select the exFAt format.

Using GParted

If we do not want to use the native Linux function that allows us to format drives, we can use the GParted application, an application that we must previously install through the terminal using the following command, but not before checking if we have any pending updates:

sudo apt-get update

sudo apt-get install gparted
Once the installation is complete, we go to the application drawer and run GParted. First of all, the application will ask us for the password of the user account, since we are going to make important changes to the system that may involve the loss of data from some of the units. Once we have opened the application, click on the drop-down box located in the upper right corner to select the unit with which we want to work.

Formatear unidades Linux con GParted

Next, once we have selected the unit, the first thing we must do is unmount it to be able to work with it. To unmount it, right-click the drive and select Unmount .

Once we have unmounted the drive, right-click on the drive and select Format As and select the file system we want to use on the drive.

Formatear unidades Linux con GParted

Using the command line

Taking into account all of the above, in order not to make any mistakes and format the drive or partition that we do not want, the first thing we must do is identify which drive and/or partition we are going to work with. To do so, we will use the command


In the following image, the main drive sda has 3 partitions: sda1, sd2 and sd3. The drive that we have connected to the computer to format is sdb and it does not have any partitions.

Formatear unidades Linux

Now that we are clear that the drive we are going to work with is sdb, it is time to format the drive using the terminal command line. In this case, we are going to use the mkfs tool, a tool that, to format drives in exFAT format, needs the fuse and utils packages, packages that we can install using the following command.

sudo apt-get install exfat-fuse exfat-utils

To format the drive in exFAT format, first of all, we need to unmount the drive as otherwise you will not be able to perform the process.

sudo umount /dev/sdb

Next, we will use the following command, to format the drive with the exFAT file system.

sudo mkfs.exfat /dev/sdb

Formatear unidades Linux

If, instead of using the exFAT format, we want to use any other format, we must replace exfat with the file system : ntfs, ext2, ext3, ext4, fat32.

Formatear unidades Linux

The type of formatting that we are going to use is the slow one, because it will take a long time to finish depending on the capacity of the drive. If we want to speed up the process, we add the /Q parameter to the code as shown below:

sudo mkfs.exfat -Q /dev/sdb