Home / Linux / How to Format a USB Drive on Linux That Works With Windows

How to Format a USB Drive on Linux That Works With Windows

Linux laptop showing a bash prompt
fatmawati achmad zaenuri/Shutterstock.com

Sometimes Linux users need to exchange files with computers running other operating systems, such as Windows or macOS. That’s simple enough with a USB drive—as long as it is formatted correctly.

Table of Contents

The Universal Format?
The Most Important Steps
Formatting with GNOME Disks
Formatting on the Command Line
Avoid the 4GB Barrier

The Universal Format?

Linux hard drives are most commonly formatted to ext4, although other formats are slowly growing in popularity such as btrfs and ZFS. These are Linux-specific file system formats. With USB drives, it’s a different story. To enjoy the maximum flexibility, and to be able to use them on Windows or macOS as well as on Linux, they need to be formatted to something that works in all three operating systems.

Obviously, using a Linux-only format isn’t going to give us what we need. Neither is using an Apple-only format. The closest thing we had to an Esperanto of file storage formats was FAT32. USB drives formatted to this Microsoft standard could be used interchangeably on Windows, Linux, and macOS. That was great until you tried to store a file that happened to be larger than 4GB. That was the fixed, upper-limit file size baked into FAT32.

Which Linux File System Should You Use?

RELATEDWhich Linux File System Should You Use?

The exFAT file system overcomes that limitation. It’s another Microsoft format, and it is compatible with macOS and—since kernel 5.4—Linux. That makes it a strong contender for the best file system for USB drives that need to work with the big three operating systems. It doesn’t have the drawbacks of FAT32, but neither does it carry the overheads and extra functionality of NTFS. That makes it fast, too.

As long as you’re on a Linux kernel that is version 5.4 or higher, you’ll be able to use exFAT just as easily as you can any of the other supported file systems. At the time of writing, the current Linux kernel is 5.18, so as long as you have a recently patched and updated system, you’ll be good to go. We’ll demonstrate a graphical method using GNOME Disks, as well as a terminal method.

The Most Important Steps

When you write a new file system onto a USB drive everything on it is erased. That means it is vital that you:

  • Verify you don’t care that anything and everything on the USB drive will be erased or ensure that you’ve copied anything you want to keep to another drive.
  • Make sure you know which storage device is the one you want to format. Don’t format the wrong drive. It’s an easy mistake to make on a multi-drive computer.

RELATED: How to List Your Computer’s Devices From the Linux Terminal

Formatting with GNOME Disks

The safest way to begin is with the USB drive unplugged. In Ubuntu, you can press the “Super” key, then type “disks” in the search field. You’ll see the disks icon. Click the icon to launch the GNOME disks application.

The disks application lists the storage devices it can find in the left-hand sidebar.

List of storage devices in GNOME disks

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

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

USB drive listed in GNOME disks

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

Click on the drive to see some information about it.

USB drive details listed in GNOME disks

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

Click on the cogged wheel icon, then click the “Format Partition…” menu option.

The "Format Partition" menu option

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

Providing a volume name for the USB drive in GNOME disks

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

The exFAT radio button selected in the Custom Format dialog

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

The confirmation page of the format dialog

The drive is formatted for you, and you’re returned to the main disks display. The entry for the USB drive now shows it is formatted with the exFAT file system.

The USB drive formatted to exFAT in the GNOME disks display

Formatting on the Command Line

The first step is to positively identify the USB drive. We can do this using the lsblk command. Without the USB drive plugged in, run the lsblk command:


The output of lsblk without the USB drive plugged in

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


The output of lsblk with the USB drive plugged in

We can see the new entry for the USB drive. It is showing up as device “/dev/sdc”, and it is mounted on “/run/media/dave/MetalUSB.”

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

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

sudo umount /run/media/dave/MetalUSB

The unmounted USB drive showing in the output from the lsblk command

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

The -L (label) option lets us provide a volume label. We’re going to call this USB drive “Metal32.”

sudo mkfs.exfat -L Metal32 /dev/sdc

Creating the exFAT file system on the USB drive

Unplug the USB drive, wait a moment, then plug it back in. Use the lsblk command once more and you’ll see the drive is now mounted and the mount point name has changed to reflect the name we chose when we created the file system.


The USB drive mounted on a new mount point

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

df -T /dev/sdc

Using the df command to check the file system of the USB drive

We can see the file system is listed as exFAT.

RELATED: How to Use the mkfs Command on Linux

Just to make sure Microsoft Windows was happy with the USB drive we plugged it into a Windows computer and looked at its properties. Windows 10 treated the drive as a functional and correctly-formatted USB drive, using the exFAT file system.

The properties of the USB drive in Windows 10

Avoid the 4GB Barrier

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

Leave a Reply

Your email address will not be published. Required fields are marked *



Check Also

How to Add and Remove Users on Ubuntu

Hannah Stryker / How-To Geek To create a new user named “maxn” ...