LWN.net Logo

On the need for a new removable device filesystem

By Jonathan Corbet
August 22, 2012
Removable storage devices, such as the USB "thumb drive," can be a pain. They are slow and often prone to errors, but, perhaps worst of all, they all seem to be designed for the VFAT filesystem. VFAT gets the job done much of the time, but it is showing its age; this filesystem was never meant for the size of contemporary devices or files. There is also the little nagging issue of the patents on the filesystem format and the associated Linux-hostile company that is actively asserting those patents. Despite all of this, removable devices are often the easiest way to ship files between machines. Given that, do we need to come up with a new filesystem to ease the pain of using these devices?

Dan Luedtke's answer is "yes"; he has implemented a new filesystem called "Lanyard" (or "LanyFS") intended for use on removable devices. He claims better performance and scalability than VFAT along with a native Linux implementation. The code shows its early-stage nature — there are a lot of things that would need to be fixed before it could be considered for inclusion into the mainline kernel — but the mainline is clearly where Dan would like it to go. The rest of the development community is not entirely convinced that we need a new filesystem for this use case, though.

The first question is: why not stick with VFAT? For all of its troubles, it has worked well enough for a long time. The biggest motivator for a change, arguably, is the 4GB limit on file size. One can deal with poor performance, especially when the real bottleneck is likely to be the device itself. But if one wants to store a sufficiently large file on the device, VFAT will simply fail. Such files are increasingly common, so users are running into this problem. The exFAT filesystem format is held out as an alternative, but it is far more proprietary than VFAT. Given that VFAT has already been the subject of lawsuits, vendors will think carefully before switching to exFAT; Sharp has licensed the filesystem for Android devices, but there do not appear to be a whole lot of other takers at this time.

Given increasing networking speeds, one could certainly consider just using the network to move a file that is too large for VFAT. On a local network this approach might well be faster than using a removable drive. Setting up network transfers is not always easy, though; most computers are, by default, configured in ways that do not allow random strangers to dump large files on their drives. Getting around that obstacle is likely to be too much even for moderately skillful users. Use of a third-party site to transfer files is workable when the files are small; even if it is possible for very large files, it's not something that will be tolerably fast on most networks.

Removable drives, instead, are easy, so the "sneakernet" approach to file transfer is likely to stay with us for some time. Does that mean that we need a new filesystem format to better support this use? Filesystem developer Ted Ts'o thinks not:

I used to think that we would need an IP unencumbered file system, given issues around TomTom and Microsoft, but these days, given how quickly Linux has taken over the embedded and mobile landscape for all but the most tiniest of devices, I don't think that's as important of an issue, since we can just simply use a native linux file system. In the time that it would take to get some other new file system adopted across the industry, it's likely Linux will have enough market share to perhaps compel the other OS vendors to provide interoperability solutions.

That is an interesting thought: Linux is now strong and prevalent enough that we can simply expect the industry to pick up our way of doing things. That approach has not always worked out in the past, but things might truly be different this time around. Increasingly, devices like music players, handsets, and digital cameras run Linux internally; these gadgets already are, to a first approximation, removable storage devices with a bit of extra hardware. Other devices, such as televisions, also tend to run Linux internally. Supporting a native Linux filesystem on these devices should be a relatively easy thing to do. It would be faster (assuming the underlying storage isn't severely optimized for VFAT only), more feature-rich, and lacking in patent aggressors. There is very little, in other words, not to like.

Well, there would be a few small problems. There are still some pesky users out there with non-Linux systems that might want to access the filesystems on their devices. In many cases, the increasing use of the MTP protocol could sidestep that question altogether; indeed, recent MTP-using Android devices are likely using it to export an ext4 filesystem. There would still be cases where users on these other platforms would want to mount filesystems directly, though, especially on pure storage devices; bringing proper implementations of Linux filesystems to those platforms is, evidently, not as easy as one might think.

Filesystems like ext4 also were not designed with removable devices in mind. They tend not to be all that robust against unexpected removal of the device unless fairly aggressive flushing of data is used (in fairness, VFAT filesystems are also easily corrupted that way). The file ownership model used by Linux filesystems tends not to translate well to removable devices, since one system's user IDs typically have no meaning elsewhere. So something like the user and group mount options patch may be required to make things work well. Most Linux filesystems have not been designed around the very large pages and erase blocks used on flash devices and, thus, do not perform as well as they could; see this article for lots of details. These are issues that can be worked out, certainly, but they remain in need of working out at this time.

There is one other complication: according to Arnd Bergmann there is another filesystem waiting on the wings:

There will be patches very soon for a new file system from a major flash vendor that I'm cooperating with. I haven't seen the patches myself yet, but the design is similar to a prototype that was done as a thesis I supervised. I hope that the new implementation is similarly simple to this design, and also able to provide optimum performance on most flash media.

Needless to say, such an entry has the potential to stir things up a bit. A filesystem designed with input from both "a major flash vendor" and a developer like Arnd should work well indeed on small removable devices and should be well integrated into Linux. This manufacturer could also employ the "include a windows driver in a small partition on the device" trick, making interoperability with most Windows systems Just Work. Putting the filesystem code into the Linux kernel would make support readily available on mobile devices. This scheme might just succeed.

So what we may see is not Linux pushing one of its native filesystem formats onto the world. Instead, the world might just adopt a new format that just happened to be well supported in Linux first. That could be the best of all worlds: we would have a way to interoperate on removable drives that is free, scalable, and widely supported. Getting there may well be worth the trouble of adding yet another filesystem type.


(Log in to post comments)

On the need for a new removable device filesystem

Posted Aug 23, 2012 3:23 UTC (Thu) by squidgit (subscriber, #42190) [Link]

> assuming the underlying storage isn't severely optimized for VFAT only

Big assumption in my (admittedly limited) experience, plenty of SD cards seem to have different wear-leveling policies for where they think the FAT(s) will sit. I've seen card lifetimes dive by 10-100x when using ext* vs FAT (and yes I turned off all any and all metadata operations I could find :). Not a barrier if the filesystem is coming from the flash manufacturer themselves though I guess

On the need for a new removable device filesystem

Posted Aug 23, 2012 16:36 UTC (Thu) by zlynx (subscriber, #2285) [Link]

I recall reading somewhere that some flash card manufacturers use small amounts of SLC flash for storing special information, such as FAT tables, block relocation tables and the like.

On the need for a new removable device filesystem

Posted Aug 23, 2012 4:04 UTC (Thu) by tnoo (subscriber, #20427) [Link]

> Well, there would be a few small problems. There are still some pesky
> users out there with non-Linux systems that might want to access the
> filesystems on their devices.

Call the extra file system layer to install a "driver". Users are trained enough by their experience to have to install a driver for almost any external tool (sometimes from micro-CDs, or random manufacturer websites) that this will be their normal user experience.

On the need for a new removable device filesystem

Posted Aug 23, 2012 8:58 UTC (Thu) by thoeme (subscriber, #2871) [Link]

Call the extra file system layer to install a "driver". Users are trained enough by their
experience to have to install a driver for almost any external tool

Can this be done on a (windows) system by a user *without* administrative priviledges?

On the need for a new removable device filesystem

Posted Aug 23, 2012 9:37 UTC (Thu) by eru (subscriber, #2753) [Link]

Can this be done on a (windows) system by a user *without* administrative priviledges?

No, at least not in Windows Vista and later versions. Not a big problem for people managing their own computer, but would hamper users in corporations.

What would work is if the drive would appear to formally just contain a VFAT or NTFS filesystem, with a single file containing the actual new filesystem filling almost all the space, plus a userspace archiver program for getting at the files on Windows. But clumsy, of course.

On the need for a new removable device filesystem

Posted Aug 23, 2012 11:48 UTC (Thu) by cortana (subscriber, #24596) [Link]

It's a shame that UDF never took off. I believe it was supposed to be suitable for portable hard disks and cheap flash as well as for DVDs. It's even supported by Windows Vista and OS X out of the box. However XP only supported it for read-only access which is I guess what killed it.

On the need for a new removable device filesystem

Posted Aug 23, 2012 13:09 UTC (Thu) by Cato (subscriber, #7643) [Link]

XP is gradually going away so UDF might resurface. More likely it will be exFAT which despite being patent encumbered does work on Windows XP or higher, OS X, etc.

Any plan for a new Linux FS for removeable devices should at least provide BSD-licensed FS code for use in Windows, Mac, etc - otherwise it's unlikely to get anywhere.

On the need for a new removable device filesystem

Posted Aug 25, 2012 11:58 UTC (Sat) by TRS-80 (subscriber, #1804) [Link]

Yes, I was going to comment that UDF is a good choice for cross-platform USB storage devices. Although, as I sit here in front of my TV, I wonder if it has UDF support for USB devices, or only NTFS and VFAT?

On the need for a new removable device filesystem

Posted Aug 29, 2012 13:56 UTC (Wed) by keeperofdakeys (subscriber, #82635) [Link]

I've tried many times to get the UDF flash drives I've created on linux to work on my friend's macs, but I've never succeeded. From what I can see, OSX checks the partition id, and there is no corresponding id for UDF.

On the need for a new removable device filesystem

Posted Aug 23, 2012 18:06 UTC (Thu) by geofft (subscriber, #59789) [Link]

> There is also the little nagging issue of the patents on the filesystem format and the associated Linux-hostile company that is actively asserting those patents

The UEFI spec includes a formalized version of FAT32 with long file names. It is free to become an "Adopter" of the UEFI specification (most parent companies of distros already are) and that grants you a patent license to everything in UEFI.

IANAL and I forget if this includes using FAT for non-UEFI purposes, but this seems like a clean solution to that problem.

On the need for a new removable device filesystem

Posted Aug 23, 2012 19:53 UTC (Thu) by mjg59 (subscriber, #23239) [Link]

The UEFI adopter agreement only grants you rights to the specification for the purpose of implementing the specification.

On the need for a new removable device filesystem

Posted Aug 23, 2012 20:46 UTC (Thu) by apollock (subscriber, #14629) [Link]

I had my first encounter with exFAT a couple of nights ago when I tried putting an SD card from my HD video camera into my Linux laptop, and shortly afterwards became very disappointed and had to pass it over to my wife and her Macbook.

On the need for a new removable device filesystem

Posted Oct 6, 2012 22:51 UTC (Sat) by JanC_ (guest, #34940) [Link]

There is a FUSE-based implementation: https://code.google.com/p/exfat/ (which is still beta).

Smartdevice usecase

Posted Aug 24, 2012 8:55 UTC (Fri) by Aissen (subscriber, #59976) [Link]

The article talks about how MTP is used to sidestep the "other OS not supporting filesystem X" issue. But it's not its only use.

MTP's nature allows the "gadget" (smartphone or any linux device) to still have access to the filesystem while it's being shared. The USB Mass storage model is "all or nothing": it forces the gadget to abandon everything it's doing with the partition/fs as soon as it's plugged; and then rescan everything (for safety, database updates, etc.) when unpluggued.

That is a problem that cannot be adressed with a new filesystem.

Smartdevice usecase

Posted Aug 24, 2012 17:25 UTC (Fri) by jimparis (subscriber, #38647) [Link]

> The USB Mass storage model is "all or nothing": it forces the gadget to abandon everything it's doing with the partition/fs as soon as it's plugged; and then rescan everything (for safety, database updates, etc.) when unpluggued.

> That is a problem that cannot be adressed with a new filesystem.

Why not? The reason the gadget needs to "abandon everything" is because none of the currently-used filesystems can handle concurrent access to the underlying device at the block level. But there are filesystems that are supposed to allow that, like http://en.wikipedia.org/wiki/Global_File_System

Smartdevice usecase

Posted Aug 27, 2012 8:02 UTC (Mon) by Aissen (subscriber, #59976) [Link]

Thanks ! I didn't know about GFS2. It still has some hardware requirements that are nowhere to be found on a mobile phone.
It would be interesting to see how this tech would apply to embedded devices.

Smartdevice usecase

Posted Aug 24, 2012 21:44 UTC (Fri) by dag- (subscriber, #30207) [Link]

And unfortunately that is why Google/Samsung ripped out the USB Mass Storage functionality from the Google Nexus phone, as well as not provide an SD slot. Which is pretty frustrating altogether :-/

The AirDroid app is a solution to access the whole filesystem, however it is not very "efficient" for large file transfers.

Smartdevice usecase

Posted Aug 25, 2012 14:03 UTC (Sat) by rvfh (subscriber, #31018) [Link]

The Nexus S already did not have a µSD port, because Google find them issue-prone. The Galaxy Nexus comes with 16 GB of internal flash though (and a broken GPS FWIW.)

Smartdevice usecase

Posted Aug 27, 2012 16:51 UTC (Mon) by mathstuf (subscriber, #69389) [Link]

How is the GPS broken? I use mine just fine…

Smartdevice usecase

Posted Aug 27, 2012 19:30 UTC (Mon) by dag- (subscriber, #30207) [Link]

I have found that the HSDPA/3G connection is not very reliable. I often find myself disabling and enabling "Mobile Data" because the device tells me I have an HSDPA connection but all apps/browsers consistently fail to connect. Either because the connection broke or it could not connect to the proxy (sic). And if my connection deteriorates from HSDPA to 3G, Edge or GPRS it does not make a difference. Once it fails, it will not recover.

Disabling and enabling sometimes helps. I have to say that I use the device mostly on the train and this is suboptimal at best, but my HTC Desire S nor my Nokia E71 had this issue so I do suspect the Google Nexus phone or this firmware (Jelly Bean 4.1.1) :-(

Smartdevice usecase

Posted Aug 28, 2012 15:34 UTC (Tue) by mathstuf (subscriber, #69389) [Link]

I've not seen this either. Service can degrade to 3G, but it goes back to 4G just fine. Of course, I still have ICS, so maybe JB changed something.

Smartdevice usecase

Posted Aug 28, 2012 15:52 UTC (Tue) by dag- (subscriber, #30207) [Link]

Well, to make things more interesting. Only yesterday-evening I powered down the phone to make sure I could test again today with a clean state. And today the signal icon gives _no signal_ at work the whole day, however most (if not all) apps do have Internet access. But I cannot call out, instead I get the message: "Mobile network not available."

3G or HSDPA (I don't know what it is using right now) works flawlessly ! So apparently you don't need a Mobile network for having 3G :) They should call it Networkless WAN :-D

Switching Airplain mode ON and OFF solved this weird situation.

I need to blog about this.

Smartdevice usecase

Posted Aug 28, 2012 15:57 UTC (Tue) by mathstuf (subscriber, #69389) [Link]

I also noticed that airplane mode had some weird behavior today as well (the charging cable is loose and gets knocked out and hasn't charged overnight twice now). Toggling wireless while in airplane mode still enabled wireless. ISTR that my Incredible had airplane mode as a "keep everything off" rather than "turn it off, but toggling overrides it" behavior.

Smartdevice usecase

Posted Aug 25, 2012 14:05 UTC (Sat) by rvfh (subscriber, #31018) [Link]

If only MTP would work... Thankfully there are SSH servers for the Galaxy Nexus!

On the need for a new removable device filesystem

Posted Aug 26, 2012 18:03 UTC (Sun) by gb (subscriber, #58328) [Link]

Hurrrah, finally someone understood that it's simpler to create new fs than stick to that fats. Switching immediately =)

On the need for a new removable device filesystem

Posted Aug 28, 2012 10:39 UTC (Tue) by etienne (subscriber, #25256) [Link]

> patches very soon for a new file system

Would be nice to have this filesystem support "large pages" of memory, having an allocation block of 2 Mbytes.
Most of the files exchanged are big, and the "FAT allocation table" located in fast FLASH (fast accessed pages of the device) are limited.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds