Wednesday, July 27, 2011

Digg this

exFAT (FAT64) on Linux

Hard Drive Platter and Arm
I have a Mac for my home computer and I use Linux and Windows at work.  One of the biggest problems I have is that there is really only one file system that works between all 3: FAT32.  FAT32 is old and clunky but it is compatible across all major operating systems, so it is the defacto choice for formatting  external drives.  The only problem with FAT32... um... it's FAT32; you can't have files larger than 4GB in FAT32.

The solution: FAT64 or exFAT.  exFAT is Microsoft's solution to large flash drives, USB sticks and the like.  It works well with Mac
and Windows.  But Linux is another story.  Fortunately, there are some things you can do to help compatibility with exFAT and Linux.  The only downside is that it's read-only :(  Hey, you can't have everything.  This post will show you how to get exFAT working with Linux - even if it is read-only.

First, download the exfat tar from

Next, extract the files from the tar by issuing the following command in the terminal: tar -xvzf fuse-exfat-0.9.5.tar.gz

Before you go any further you are also going to need fuse development libraries.  To install these (in Ubuntu 11.04) issue the following command in the terminal: sudo apt-get install libfuse-dev

When libfuse-dev installs, cd into the exfat directory by issuing the following command in the terminal: cd exfat-read-only

Now type the following command in the terminal to compile: scons

Once compiled, install exfat by issuing the following command in the terminal: sudo scons install

Before you plug in your external ExFat drive, check the existing partitions by typing the following in the terminal:  cat /proc/partitions

Now plug in your external exFat drive and check the partitions again using the same command.  The new partition listed will be your external drive.  Mine is sdb1.  Remember that partition id.  We will use it to mount the exFat drive.

Before we mount the exFat drive, a directory must exist to mount it to.  I put my directory in /media and I call it exFat.  To create this directory, type mkdir /media/exFat

Now you are ready to mount your external exFat drive.  To do this type sudo mount -t exfat /dev/sdb1 /media/exFat where sdb1 is the id of your external exFat drive partition.

Your exFat external drive should now be mounted and readable.


Anonymous said...

Is there a way to automate this process so that this can be done automatically at login?

Clayton Long said...

Off the top of my head: You could add it to your .profile and have the drive mount automatically when you open a shell. You could also add a script to the /etc/init.d directory and then run update-rc.d (for Ubuntu/Debian flavors) to make it run on startup. Additionally, in the classic desktop you can navigate to System->Preferences->StartUp and add something there to launch on login.

Quentin102 said...

Hello. I have had lots of problems with my pendrive. One day suddenly was write prottected, I formated it to exfat and fix it. Then I tried to get it back to fat32 on my windows computer and the formatting failed and it was unformatted and write protected. I found the usb DIV and all of that and managed to get it working again on exfat.

Now I'm affraid to tryto format it to fat32 again on my windows computer. I managed to get it workin as read only in linux and I was wondering...

Is there a way I can format it to fat32 on linux? what do you think, I should just leave it working in exfat?

Clayton Long said...

If you want to use files larger than 4GB then leave it as exfat. Otherwise, there is nothing wrong with formatting it to fat32. You will, however, lose the data you have stored on your drive. You can format to fat32 on linux by using dosfstools. Something like this should work "mkdosfs -F 32 -I /dev/sdc1", where /dev/sdc1 is the path to your USB drive.

Post a Comment