How to Safely Format and Label an ExFAT USB Flash Drive in Linux Terminal Using mkfs.exfat

Transferring large video files, virtual machine disks, and compressed datasets between Linux distributions, Microsoft Windows, and macOS requires a modern filesystem that avoids operating system barriers. While native Linux filesystems like ext4 deliver robust journaling and POSIX permission models, they cannot be read natively on Windows or macOS without specialised drivers. Conversely, legacy FAT32 formats impose a strict 4GB single-file limit that causes modern ISOs and video archives to fail immediately. The Extended File Allocation Table (exFAT) architecture provides the optimal cross-platform storage solution. Formatting external thumb drives and portable SSDs with exFAT via the Linux command line gives you complete control over partition alignment, volume naming, and drive stability.

Verifying and Installing exFAT Userspace Tools

Modern Linux kernels include native in-kernel exFAT drivers, but formatting and checking exFAT partitions requires the dedicated userspace package exfatprogs (or the legacy exfat-utils on older distributions). Before manipulating storage media, verify that the required filesystem generation binaries are installed:

On Debian, Ubuntu, Linux Mint, and derived distributions, execute:

sudo apt update && sudo apt install exfatprogs

On Fedora and RHEL-based systems:

sudo dnf install exfatprogs

On Arch Linux and Manjaro:

sudo pacman -S exfatprogs

Identifying the Correct USB Block Device Safely

Formatting permanently destroys all existing data on the targeted partition. To prevent accidental overwriting of internal system drives or swap partitions, you must accurately determine your USB drive’s hardware device node:

  1. Insert the USB flash drive into an available port on your computer.
  2. Open your terminal emulator and list all connected storage devices using lsblk:
    lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS,MODEL
  3. Examine the output carefully. Identify your USB drive by matching its capacity and manufacturer model string (for example, a 64GB SanDisk drive might appear as sdb with a single partition sdb1, whereas your internal SSD typically appears as nvme0n1 or sda).
  4. Confirm whether any partitions on the target drive are currently mounted by reviewing the MOUNTPOINTS column.

Unmounting Active Partitions Before Formatting

Linux automatically mounts inserted storage volumes under /media/ or /run/media/. You cannot format an active filesystem while it remains mounted by the desktop environment. To unmount the partition safely:

sudo umount /dev/sdX1

Note: Replace /dev/sdX1 with your exact device node identified in the previous step (such as /dev/sdb1). Never apply commands to an unverified drive identifier.

Creating the exFAT Filesystem with a Custom Volume Label

Once the target partition is successfully unmounted from the operating system tree, format the volume using the mkfs.exfat command. Adding the -n flag assigns a persistent volume label that displays in Windows File Explorer, macOS Finder, and Linux desktop file managers:

sudo mkfs.exfat -n "MYDRIVE" /dev/sdX1

The command initialises the file allocation table, allocates root clusters, and outputs confirmation details including sector size, cluster size, and total usable capacity. If you wish to wipe the entire drive and establish a clean GPT partition table before formatting, you can use parted or fdisk to write a fresh partition boundary prior to running mkfs.exfat.

Verifying the Filesystem and Safely Ejecting the Drive

After formatting completes, verify that the new exFAT filesystem and volume label are recognised correctly by the kernel:

lsblk -f /dev/sdX1

The output will reflect exfat in the FSTYPE column alongside your assigned volume label. Before disconnecting the physical USB drive, issue the sync command to flush all remaining cached write buffers to hardware, followed by a clean hardware power-down:

sync
sudo eject /dev/sdX

Your USB drive is now completely prepared to transfer files of any size seamlessly across Windows, Mac, and Linux computers.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.