November 16, 2012

The Not-Ready Btrfs and ExFAT Linux Filesystems

Two newer filesystems of importance to Linux are exFAT and Btrfs. exFAT is the controversial Microsoft filesystem for Flash memory devices, and Btrfs is for "big data". Once upon a time there was much sound and fury around these, but lately it's been quiet, so let's see what's been happening.


In this glorious year 2012 in the new millennium, it is rather astonishing that there is not a common, open, unencumbered filesystem for Flash storage devices. Cameras, game consoles, music players, phones, and USB storage devices are everywhere, and it makes no sense to make something as fundamental as a filesystem into a roadblock. But it is, thanks to our good friends in Redmond.

536px-Betacam SP Camcorder 01 KMJSony Betacam Camcorder. Image courtesy Wikimedia Commons.

Microsoft's creaky old FAT filesystems, FAT16 and FAT32, have long been the de facto standard filesystems for Flash storage devices. They enable portability because FAT is supported on all major operating systems, and they don't have access controls so there are no permissions hassles-- just plug in your device and use it. But despite FAT's age and ubiquity, Microsoft successfully enforced its FAT patents against TomTom in 2009. TomTom agreed to drop FAT32 support from their products, several of which were built on Linux. Microsoft has also gone after Android vendors, such as Motorola, who use FAT.

The legal landscape, as always, is bizarre. Linux can support FAT32 without paying royalties because of an inane technicality: long and short filenames. My fellow old codgers recall the 8.3 DOS filename convention: filenames could be no more than 8 characters long with a 3-character extension. This collided with grownup filesystems that supported longer filenames, which FAT truncated. And that is why something like nicelongfilename.txt would be shortened to nicelo~1.txt.

When Microsoft finally figured out how to support longer filenames (up to 255 characters), they were able to patent this long filename extension to FAT. When Microsoft sued TomTom it caused a fair bit of worry that Linux developers and vendors would become litigation targets. Andrew Tridgell (one of the lead Samba developers) wrote a kernel patch to disable the creation of 8.3 short filenames. This was enough to dodge the long-filename patent, which covers implementations that support both short- and long-filenames. (I am not making this up; see for yourself.) If you need 8.3 support, use the msdos filesystem driver.

FAT32's usefulness has been declining for some time anyway, because it cannot support files larger than 4GB, it's inefficient, and it becomes more inefficient with larger volume sizes. And so around 2009, there was a golden moment when manufacturers of all the nifty devices we use could have banded together and developed an open common filesystem. There are multiple benefits to this approach: data portability, ease of use, community support, and no royalties. It could even have been based on any of the excellent existing open source filesystems.

But no. Microsoft blew the dust off exFAT, which was originally developed for Windows Embedded CE and is essentially FAT64, and made deals with the SD Association and hardware vendors. So SDXC memory cards are formatted with exFAT because it is part of the SDXC specification, and this month Sharp, Sigma, NextoDi, Black Magic and Atomos Global signed agreements to use exFAT on their products. This includes high-end camcorders, Android tablets, and digital cameras.

Linux users have options, sort of. Tuxera sells a good exFAT driver, but only to OEMs, such as Android vendors. There is a free exfat driver, fuse-exfat, and it is included in several distros. This is built on fuse, filesystem in userspace. I've tested it a bit without problems, but the developers do not have access to any specifications and it's still young, so it has some rough edges. I would not rely on it for syncing a Linux PC with devices that use exFAT, like cameras and smartphones.

Butter Filesystem

The Butter/Better/B-tree Filesystem, Btrfs, has elevated the hopes of filesystem nerds and kept us in a state of suspense, because it was supposed to be production-ready earlier this year. As 2012 fades away it isn't ready-- it is still considered experimental by the Linux kernel developers, even if it is the default filesystem in Oracle Unbreakable Linux. Perhaps the Oracle Unbreakable Enterprise Kernel has extra-rugged Btrfs-fu.

Rvk mun arch file cabinets 2011Massive file cabinets. Image courtesy Wikimedia Commons.

Me, I take my filesystems seriously, because a buggy filesystem eats data. (Like the recent Ext4 bug, oops.) I wonder if Oracle is as fast to fix bugs as the Linux kernel team? At any rate there are a few ways to try it out. The easiest way is to run a Linux distribution that includes it, like Debian, Ubuntu, Gentoo, OpenSUSE, Fedora, and Arch. Btrfs is already built into the Linux kernel, so all you do is install the userland tools.

Distros are always going to lag behind the latest builds, so you can snag the latest versions from the git repo. If you go this route you'll also need the latest kernel.

The best introduction to administering Btrfs is a two-part series on Oracle's Technet: How I Got Started with the Btrfs File System for Oracle Linux and How I Use the Advanced Capabilities of Btrfs. Filesystems are fascinating, and Btrfs promises to be the big-time datacenter Linux filesystem with advanced built-in management tools and ├╝ber-reliability.

Click Here!