How to format a USB drive on Linux that works with Windows

fatmawati achmad zaenuri / Shutterstock.com

Linux users sometimes need to exchange files with computers running other operating systems, such as Windows or macOS. This is simple enough with a USB drive – as long as it’s properly formatted.

global coordination?

Linux hard drives are often formatted to ext4although other formats are slowly growing in popularity such as btrfs And the ZFS. These are Linux file system formats. With USB drives, it’s a different story. To enjoy maximum flexibility, and to be able to use it on Windows or macOS as well as on Linux, it needs to be formatted to something that works in all three operating systems.

Obviously using only the Linux format won’t give us what we need. Neither of them uses the Apple format only. It was the closest thing we had to Esperanto than file storage formats FAT32. USB drives formatted according to this Microsoft standard can be used interchangeably on Windows, Linux, and macOS. That was great until I tried to store a file that happened to be larger than 4GB. This was the upper limit flat file size baked into FAT32.

The exFAT The file system overcomes this limitation. It’s another format from Microsoft, and it’s compatible with macOS and – since kernel 5.4 – Linux. This makes it a strong contender for the best file system for USB drives that need to work with the three major operating systems. It doesn’t have the flaws of FAT32, but it also doesn’t carry the NTFS overhead and add-ons. This also makes it fast.

As long as you are using Linux kernel version 5.4 or higher, you will be able to use exFAT just as easily as any of the other supported file systems. At the time of writing, the current Linux kernel is 5.18, as long as you have a recently patched and updated system, you should be fine. We will explain a graphical method using GNOME tablets, as well as a terminal method.

The most important steps

When you write a new file system to a USB drive, everything on it is erased. This means that it is necessary to:

Related: How to list your computers from a Linux terminal

Formatting with GNOME Disks

The safest way to get started is with a USB drive not connected. In Ubuntu, you can press the “Super” key, then type “disks” in the search field. You will see a file disks icon. Click the icon to start GNOME disks Request.

The disks The app lists the storage devices it can find in the left sidebar.

List of storage devices in GNOME disks

This computer has a combination of Physical drives, SSD drives, and an optical CD/DVD drive.

Connect the USB drive. Linux will detect it, and the change will be reflected in GNOME disks Request.

USB drive included in GNOME Disks

The drive has been added to the list of known storage devices and is correctly identified as Kingston Data Traveler. The total capacity of this USB drive is 32 GB, but it is displayed as 31 GB. This is because you lose a little space when formatting the drive. Don’t be surprised if the capacity of your USB drive is not as much as you expect.

Click on the drive to see some information about it.

USB drive details included in GNOME Disks

We can see that it is formatted with the ext4 file system, and its Linux designation is “/dev/sdc”.

Click the sprocket icon, then click the “Format Partition…” menu option.

The "Section Format" Menu option

Type a name for the USB drive, select the “Other” radio button, and then click the “Next” button.

Provide a volume name for a USB drive in GNOME Disks

Select the “exFAT” radio button, then click the “Next” button.

The exFAT radio button is selected in the dialog box

You have been warned that the USB drive will be wiped clean, and you will be shown the drive details so that you can confirm that it is the drive you intend to format. Only when you are satisfied that it is the correct drive, click the red “Format” button.

Confirmation page for formatting dialog

The drive has been formatted for you, and you will be returned to the main drive disks Show. Inserting the USB drive now shows that it is formatted with the exFAT file system.

USB drive formatted to exFAT in GNOME Disk View

Formatting on the command line

The first step is to positively identify the USB drive. We can do this using lsblk ordering. without Connected USB drive, turn on lsblk ordering:

lsblk

lsblk output without connecting a USB drive

Plug the USB drive into your computer and wait a moment for Linux to recognize and install it. Then run the same lsblk ordering:

lsblk

lsblk output with USB drive connected

We can see the new entry for the USB drive. It appears as “/dev/sdc” device, and is installed to “/run/media/dave/MetalUSB.”

Before we can format it, we need to Unpack it. We will need to use sudo. Note that there is no “n” in the “umount” command.

We pass the installation point to umount ordering. What this does is unload file system. If we use a file lsblk We will see that the USB drive is still recognized, but it is no longer associated with a mount point.

sudo umount /run/media/dave/MetalUSB
lsblk

The unmounted USB drive is shown in the output from the lsblk command

To format the USB drive with the new file system, we use a file mkfs.exfat ordering. We need to point to the USB drive with its device name, which is “/dev/sdc”.

The -L The (label) option allows us to provide a volume label. We will call this USB drive “Metal32”.

sudo mkfs.exfat -L Metal32 /dev/sdc

Create an exFAT file system on a USB drive

Unplug the USB drive, wait a moment, then plug it back in. use file lsblk command again and you will see that the drive is now mounted and the mount point name has changed to reflect the name we chose when we created the file system.

lsblk

The USB drive is installed to a new installation point

To check that the file system is indeed exFAT, we can use the df command with the extension -T (type) option.

df -T /dev/sdc

Use the df command to check the file system of a USB drive

We can see that the file system is listed as exFAT.

Related: How to use the mkfs command on Linux

Just to make sure that Microsoft Windows was happy with the USB drive, we plugged it into a Windows PC and checked its properties. Windows 10 treated the drive as a functional and properly formatted USB drive, using the exFAT file system.

USB drive properties in Windows 10

Avoid the 4GB barrier

The theoretical maximum file size under exFAT is 16EB (Exbibytes). While you’re unlikely to need to transfer a file of this size, the need to transfer and share files larger than 4GB is a common enough requirement to make exFAT a good candidate for a universal format for USB drives.



(Visited 1 times, 1 visits today)

Related posts