martes, 12 de noviembre de 2013

How to enable exFAT in Ubuntu

Today's modern filesystems were built with spinning-disk hard drives in mind. This is true for Linux's Ext2/3/4, Windows' NTFS, and server filesystems like XFS and ZFS. And, of course, so was the original FAT though it wasn't so much optimised, more simply being one of the first filesystems designed to address magnetic media.

However it's the simplicity of FAT that makes it attractive for the new generation of storage mediums based on flash memory. Usually, flash memory devices (think SD/memory cards and USB keys) don't have the fastest interfaces to the computer, and any overhead a filesystem introduces simply slows it down. And, because flash storage devices don't often approach the volume of spinning-disk drives, you don't need advanced filesystems to handle them.

FAT has its limitations, of course, which is why Microsoft's extended FAT32 is the de-facto for flash storage, providing the ability to address up to 2TB using traditional 512-byte sectors, while maintaining the simplicity and speed of FAT. Though, of course, it also lacks features that modern filesystems have such as security and journaling - but these aren't often needed for flash storage.

However while having served well for some time now, FAT32 has its limitations too - mainly the inability to handle single files larger than 4GB. As a filesystem it's also not the most efficient, and can slow down dramatically when large volumes of files are stored in a directory.

Which is why Microsoft introduced exFAT in Windows Vista and Windows 7. exFAT is built on the simplicity of FAT but designed specifically for large volume flash media, the type of which we now find in memory cards for cameras, portable USB drives and so on.

exFAT is faster than FAT32 and does a better job of maintaining speed with large volumes of files. In other words, if you're carrying around and regularly use USB keys or memory cards, you should be probably be using exFAT to make the most of them.

Which is all fine and dandy, except that Linux can't read exFAT volumes. At least, not without a little extra help. 

So, if your USB key carrying escapades include transferring data between mixed-environment systems, you've got a bit of a problem.

While Linux has long had support for FAT and FAT32, as a new proprietary filesystem we've had to wait for the development of a reverse-engineered version of the exFAT driver to get support under Linux. Development versions of the Linux exFAT have been available over the past year, but you needed to compile it yourself and futz around with setting it up. Now, however, the driver has matured and thanks to a PPA (Personal Package Archive) can be installed and used in Ubuntu in just a few steps.

Formatting for exFAT

While the Linux exFAT driver supports reading and writing to exFAT volumes, it's so new there isn't currently support for creating exFAT volumes. So, for the moment, you'll need to start using an exFAT volume by first formatting the device in Windows Vista or Windows 7. This is easy enough to do by simply plugging in the drive, right-clicking on it in My Computer, and selecting 'Format'. When the dialog appears, choose exFAT as the filesystem.


Formatting in Windows 7 for exFAT.

Installing and mounting

To install ExFat support in Ubuntu, pull up a console (‘Applications > Accessories > Terminal’) and run:

sudo -s
apt-add-repository ppa:relan/exfat
apt-get install fuse-exfat

The driver uses the FUSE (filesystem in userspace) framework. For it to work, FUSE needs to be enabled in the kernel. If you use the stock Ubuntu kernels then this is the default, so you don't have to do anything else. If you roll your own drill down to ‘Filesystems > FUSE’ and either compile it in statically or enable it as a 'M'odule, then compile and install your kernel.

While available as a module, Ubuntu won't know to automatically use the driver when you insert an exFAT device. For now you'll need to manually mount the device and specify the exFAT filesystem. Plug in your device and run:

cat /proc/partitions
Chances are your USB device will be the last partition listed. You can also check by looking at its size and seeing if it matches the size of your USB key. 

Next make a temporary directory where you can mount the device. Ubuntu by default attaches removable media under the /media directory, so you might as well do the same. Enter the following:

cd /media
sudo -s
mkdir usbdrive
mount -t exfat /dev/sdd1 usbdrive

The drive will appear on your desktop, and you can read and write to it like any other. To safely unmount it before removing, use 'sudo umount usbdrive' from the same directory.

Mounting an exFAT filesystem.

No hay comentarios:

Publicar un comentario