Add support for exFAT to Ubuntu

This guide will show you how to add support for the exFAT filesystem to your Ubuntu system.

Ubuntu exFAT

exFAT is a file system written and designed by Microsoft with the intention of it being optimized for flash memory such as an SD Card or USB drive.

Until recently, Linux has not had any native support for the exFAT filesystem due to its original proprietary nature.

We will be showing you how you can compile exFAT support as a kernel driver for Ubuntu systems.

Additionally, for those running old Ubuntu versions, we will also show you how to install the exFAT fuse driver. This driver doesn’t have the same performance as the kernel module but is better than having no support for exFAT.

Please note that you will need to know the version of Ubuntu that you are running before proceeding.

If you are running Ubuntu 20.10 or newer, then you don’t need to do anything as exFAT support is included with the newer versions of the Linux kernel.

Ubuntu 20.10 uses the 5.8 version of the Linux Kernel. All versions of the Linux kernel since 5.7 have a well-written, exFAT driver baked-in.

For those running a version of Ubuntu older than 12.10, you will need to install the exFAT FUSE driver.

If you are using the desktop version of Ubuntu, you can open the terminal by pressing CTRL + ALT + T.

You can also complete the steps by using an SSH connection to your Ubuntu machine.

Using the Kernel exFAT Driver on Ubuntu

The best method for adding exFAT support to your Ubuntu system is to compile and install a special exFAT driver.

While it requires a few more steps to get up and running, its performance is way better than that of the userland-based FUSE exFAT driver.

In the following two sections, you will learn how to prepare your system and compile the kernel exFAT driver.

Preparing your Ubuntu System for exFAT

As we compile the exFAT kernel driver for Ubuntu from the source code, we need to have installed a few things.

This section will show you how to get your Ubuntu system ready to compile the kernel module for the exFAT filesystem.

1. Our first step is to ensure we have an up-to-date system to work off of.

Luckily updating Ubuntu is as simple as running the following two commands within the terminal.

sudo apt update
sudo apt upgrade

2. Next, we can download and install the packages we need to compile the exFAT driver on our Ubuntu system.

Run the following command to install both git and the build-essential.

sudo apt install git build-essential gcc-12

We will use git to retrieve the exFAT kernel driver code.

The build-essential package ensures that we will have all the software needed to compile that code.

3. To keep things somewhat clean, we will change to the current user’s home directory.

We can use the cd command followed by the tilde (~) symbol to change to the home directory.

cd ~

4. For our next step, you will need to know what version of Ubuntu you are running.

These steps differ slightly as versions of Ubuntu older than 17.04 will have to clone an older branch of the code.

Ubuntu 17.04 to Ubuntu 20.04

Use the following command if you are running on a version of Ubuntu from 17.04 and newer. For example, Ubuntu 18.04 and Ubuntu 20.04.

git clone https://github.com/arter97/exfat-linux

Ubuntu 16.04 and Older

If you are still running an older version of Ubuntu, such as 16.04, you will need to clone the older version of the repository.

While this version is no longer maintained, it should still work more than good enough to handle exFAT on your Ubuntu system.

git clone --branch old https://github.com/arter97/exfat-linux

Compiling the Kernel exFAT Driver for Ubuntu

Once you have prepared your Ubuntu system, we can compile the exFAT driver on Ubuntu.

With the code cloned to our machine and the required packages installed, compiling the code is straightforward.

5. Before we proceed any further, we need to ensure we are in the directory we just cloned.

If you have been following this tutorial, this directory should be at “~/exfat-linux“.

cd ~/exfat-linux

6. You can use the make command to prepare and compile the code for Ubuntu.

This command will read in the Makefile to see how it should compile the source into the final file.

make

Please note, if you see an error like the one below, it means your kernel should already include an exFAT driver, and you do not need to install this one.

/home/pimyubu/exfat-linux/compat.h:12:2: error: #error "This driver doesn't support v5.8+, " "please use the included driver from your kernel"
   12 | #error "This driver doesn't support v5.8+, " \
      |  ^~~~~

7. Once the system finishes compiling the kernel module, we can install it.

To install the exFAT kernel module to the Ubuntu system, we need to run the following command.

sudo make install

8. Before we load in the new kernel module, we need to restart the device.

This ensures if there is an older version of the exFAT driver, it won’t be automatically loaded.

sudo reboot

9. When your Ubuntu machine finishes restarting, we can now load in the new exFAT kernel driver.

To load in the module, we need to use the modprobe command followed by exfat.

sudo modprobe exfat

Please note that every time you upgrade the kernel, you will need to use modprobe again.

10. You can verify that exFAT is now an accepted filesystem format by using the following command.

This command will use the cat command to output the “/proc/filesystems” file’s content.

cat /proc/filesystems

Using the exFAT FUSE Driver

FUSE stands for “filesystem in userspace” and is a software interface used in Unix-like systems like Ubuntu.

This interface allows you to expand the supported filesystems of a system without installing drivers at a kernel level.

The biggest downside of using a FUSE base driver is that they tend to be significantly slower while consuming more CPU resources.

1. Before we install the exFAT FUSE driver to Ubuntu, we should first update the system.

Run the following two commands on your system to update both the package list and upgrade the packages.

sudo apt update
sudo apt upgrade

2. With the system up to date, we can now install the userland exFAT driver.

This process is straightforward as the driver we need is available on the package repository.

sudo apt install exfat-fuse exfat-utils

3. With the exFAT FUSE driver now installed on your Ubuntu device, you can safely connect your exFAT drives.

From now on, when you connect these drives to your computer, they will be automatically mounted.

Conclusion

At this point, you will now have exFAT drivers installed on your Ubuntu machine.

From now on, whenever you connect an exFAT drive, the system will be able to detect it and mount the drive automatically.

For most users, you should now be running the kernel version of the exFAT driver. This version of the driver boasts the best performance and compatibility.

If you have had issues with that, you may have had to install the slower, exFAT FUSE driver.

If you experienced any problems when setting up exFAT support on your Ubuntu device, please leave a comment below.

Be sure to check out our other Ubuntu guides if you want to learn more about the operating system.

Leave a Reply

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