Is it possible to create and format an exFAT partition from Linux?


Yes, there is a project implementing exfat and the related utilities at relan/exfat.

To format a partition, use mkexfatfs / mkfs.exfat like with most filesystems, e.g.:

mkfs.exfat /dev/sdX1

As for creating the partition in the first place, this is the same as for any other filesystem. Create a partition in your favourite partition manager. If you have an MBR partition table, set the partition type to NTFS (that is, code 7).

Note, that some distributions only package the fuse module, so you may have to build it yourself.

  • 21
    On Ubuntu I just had to install a couple packages first: sudo apt-get install exfat-utils exfat-fuse. Source: askubuntu.com/a/374627/18665 – bmaupin Aug 28 '15 at 18:21
  • 3
    To be clear, the code is 7 (hex), not 7h. – thetoolman Mar 17 '16 at 0:27
  • On modern fdisk the type you want is 11 (Microsoft basic data). Disregard the google.code.com link in the answer and instead use @bmaupin's command on Debian/Ubuntu. – Adam Katz Dec 2 '17 at 20:07
  • be careful while doing this, it didnot warn me and completely deleted all the files I had in it. So first backup and then do it – doniyor Mar 30 '18 at 9:58
  • 2
    This worked fine for me. I already had the exfat and fuse installed. BUT... the post blow from Billious is misleading. IF you have just formatted a drive, you must supply more information to mkfs.exfat -- Like where to put the partition and how big, ya-da-ya-da. I'm just lazy. I used gParted to set-u my USB how I wanted. Leave the partition you want to make exFAT alone. Or format it to FAT32 to process the whole USB. Next ensure the target partition is unmounted. Proceed, e.g.: sudo mkfs.exfat -i DAT -n data /dev/sdc3. I let gParted deal with alignments and such. – will Oct 8 '18 at 13:09

The mkfs.exfat solution above works if a partition already exists on a drive, like a purchased USB pen drive. Use this link if you're starting from a bare disk:

Formatting a Universal Drive

  • I tried following several guides, which all failed in Fedora 29. This one worked. :) – Nick Ribal Nov 6 '19 at 4:08
  • This is an incredibly useful analysis. Thank you! – Joe Sadoski May 4 at 3:36

On the command line, the process is as follows:

Use the lsblk command to find out which drive your usb stick is. (for example /dev/sdx)


Then start parted and tell it which drive you want to perform operations on:

sudo parted /dev/sdx

In parted interactive mode type:

mklabel msdos

Now reboot. And after the reboot do:

sudo parted /dev/sdx

And in parted interactive mode type:

mkpart primary ext4 0% 100%

When the partition is created, press q to exit parted.

Now that the flash drive contains a partition, create an exFAT filesystem on the newly created partition (replacing the ext4 filesystem that only works on Linux):

sudo mkfs.exfat /dev/sdx1

Copy-pasted from https://forum.manjaro.org/t/how-to-format-a-usb-stick-so-that-it-is-usable-on-manjaro-windows-and-macos/3972

Personally, I skipped the "reboot" step. Instead, I pulled out the USB stick (sdb went away) and after reinserting it came up as sdd. If it wasn't obvious, with sdx1 the "x" could be any letter of the alphabet (usually it's a, b, c, d...) but it depends on your particular setup.


Install exFAT utilities first.

sudo apt install exfat-utils


sudo mkfs.exfat -n Volume Name /dev/USB_dev_file

See guidance below for completely wiping and restoring afresh any USB pen drive from anuy Linux command line/terminal. I often do this when pen drives become corrupted and stop working. In this example, the pen drive is /dev/sdb, but yours may be different,

sudo fdisk -l

This lists the disks/partitions. Remember the correct /dev/sdx name for the device. In this example it is /dev/sdb

You may need to unmount any already mounted partitions - e.g sudo umount /dev/sdb1, etc.

The following wipefs command will remove any existing file systems from the drive. If you do not have wipefs installed, install it using your package manager.

sudo wipefs --all /dev/sdb

At this point, all file systems have been removed, any data on the drive is technically still recoverable. To permanently wipe all data from the drive :-

sudo dd if=/dev/zero of=/dev/sdb bs=1M

This dd command should complete quickly. This writes zeros (the if = input file) to the of (output file), which is the device. The bs (block size) flag sets how many bytes to read/write at a time, the default is 512 bytes, but above it has being set to 1 megabyte (or 1,000,000 bytes).

OR, for a more secure version which writes random data instead of zeros :-

dd if=/dev/urandom of=/dev/sdb

This one can take a while.

The pen drive is completely wiped now. and all data is unrecoverable.

If you want to now create a bootable USB drive now in Linux from an OS ISO file, use the dd command again here, e.g.

dd bs=4M if=ubuntu-12.04.2-server-i386.iso of=/dev/sdb

The pen drive is now bootable, and no further action is needed if this is all you want to do.

Or, to create a blank pen drive for storage purposes, you could put the drive into a Windows machine and format there, which might be easier/quicker, but to partition the pen drive in Linux, continue below as below

sudo fdisk /dev/sdb

This goes into the fdisk program. You need to now input specific commands in the following order.

  1. Option d - this delete partitions (this is not needed if you have used the dd command above on the device). Repeat for each partition if present.

  2. Option n - create a new partition, just accept all the defaults (unless you need multiple partitions of specific sizes, most people won't)

  3. Option w (write changes)

To create a vFAT partition (readable on Windows)

sudo mkfs -t vfat /dev/sdb1

Or, to create exFAT partition, use the following command instead:-

sudo apt-get install exfat-utils exfat-fuse #if not already installed
sudo mkfs.exfat -n volume_name /dev/sdb1

When complete, Linux should auto-mount the device. If not, mount the device as below :-

mkdir /media/usbdrive
mount /dev/sdb1 /media/usbdrive

Disks (gnome-disks) and KDE Partition Manager are two GUI tools that can achieve this. (Gparted cannot do it.)

For USB sticks, there is the USB Stick Formatter, part of the mintstick tool .

  • Mint Stick helped a lot. as I was using Mint and did not realise its existence. – Ramesh Jun 6 '20 at 5:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.