Partition USB drive to ExFAT using fdisk (Debian 12)
This guide explains how to partition and format USB storage devices (flash drives, external HDDs/SSDs) to the ExFAT filesystem on Linux systems.
ExFAT supports files larger than 4GB and provides cross-platform compatibility with modern operation systems: Windows, macOS, and Linux.
Warning: Remember to back up important data from all disks before partitioning! Any mistake in the device name can lead to irreversible data loss.
The OS I chose to partition the drive is Debian 12, but it will work in any Debian derived OS (Ubuntu, Raspbian OS, Linux Mint and so on).
Installing required packages
Install required packages:
sudo apt update
sudo apt install exfatprogs -y
The exfatprogs
package provides:
mkfs.exfat
- Creates the exFAT filesystemfsck.exfat
- Checks and repairs exFAT filesystems
Note: The version of exfatprogs
I'm using is 1.2.0
, that can be checked with:
dpkg -l exfatprogs
Partitioning and formatting process
1. Identify the USB device
List all storage devices:
sudo fdisk -l
Look for your USB device (usually /dev/sdX where X is a letter).
Example output:
Disk /dev/sda: 119.24 GiB, 128035676160 bytes, 250069680 sectors
Disk model: SanDisk X400 2.5
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc5bfc900
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 250068991 250066944 119.2G 83 Linux
Disk /dev/sdb: 7.23 GiB, 7759462400 bytes, 15155200 sectors
Disk model: TransMemory
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x76fd1384
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 0 1292287 1292288 631M 0 Empty
/dev/sdb2 4524 23563 19040 9.3M ef EFI (FAT-12/16/32)
In this example, /dev/sda
is the drive where Linux is installed, and /dev/sdb
is the USB drive I will partition.
2. Create the new partition
Access fdisk:
sudo fdisk /dev/sdX
Follow these steps:
- Type
g
to create a new empty GPT partition table. This will delete all existing partitions. - Type
n
for new partition - Select
p
for primary - Press
Enter
twice for default first/last sectors - Type
l
to list available partition types. - Type
t
to change the partition type. - Type
11
forMicrosoft basic data
. - Type
w
to write changes
3. Create an exFAT filesystem
sudo mkfs.exfat -n LABEL /dev/sdX1
and replace LABEL
with your desired name.
This command will create an exFAT filesystem, format it and label it, all in one step.
A successful output will look like this:
exfatprogs version : 1.1.0
Creating exFAT filesystem(/dev/sdb1, cluster size=131072)
Writing volume boot record: done
Writing backup volume boot record: done
Fat table creation: done
Allocation bitmap creation: done
Upcase table creation: done
Writing root directory entry: done
Synchronizing...
exFAT format complete!
4. Check the newly created filesystem (recommended)
Note: The partition might need to be unmounted before running the check command.
sudo fsck.exfat /dev/sdX1
Example output:
fsck.exfat 1.1.0
exfatprogs version : 1.2.0
/dev/sdb1: clean. directories 1, files 0
Resources
- mkfs.exfat(8) manual page (Debian Manpages)
- Partitioning with fdisk (Linux Documentation Project)
- Format a USB Disk as exFAT on Linux ('It's FOSS' blog)
- Manpages of exfatprogs in Debian bookworm (Debian Manpages)