Back to article
What's The Fastest Linux Filesystem On Cheap Flash Media?
What's The Fastest Filesystem On Cheap Flash Drives?
October 26, 2010
Compact Flash and SD storage cards are everywhere; gigabytes for cheap in a tiny form factor. Most come formatted with VFAT. So what is the fastest Linux filesystem for these little devices?
Flash drives and SD Cards are getting bigger, faster and cheaper. They're not just for sucking down snaps from your pocket camera any more: they're backup storage, portable homedirs, netbook expansion ... you name it.
Most arrive with a VFAT filesystem, and usually stay that way. But for a lot of applications, this is not ideal. Curious if the filesystem made any difference, we did what Feynman would have done: tested some.
For once, testing gave a pretty clear answer. So what is the fastest filesystem linux folks can use on their flash media?
In some situations, more than four times as fast as ext3. Surprised? So was Ted Ts'o, a lead designer and maintainer of the ext4 filesystem. "You're seeing a 4x improvement in speed between ext3 and ext4?" Ted asked. "That is impressive, and quite surprising to me." He added: "I've been primarily focused on speeding up ext4 on HDDs, and on my laptop hard drive (an Intel X25-M SSD), and not really on thumb drives."
Let's take a look at some of the numbers that provoked Ted's curiosity. The times are seconds it took to write the complete, uncompressed linux 2.6.34 kernel directory to a newish Class 10 SD card, then read it back (after flushing the caches). Smaller is better:
Ext2 Ext3 Ext4 Reiser3 VFat NTFS Write 368 501 125 582 518 174 Read 53 60 53 72 98 118Almost exactly four times as fast as ext3, almost three times as fast as ext2, and clearly best overall for writing. NTFS put up a good show until reading, where it came in dead last. Be warned about Reiser, it's always slow on flash.
So is it always like this? Well, no. One thing you learn testing flash drives: they make no sense. Results are often paradoxical. For example, here's exactly the same test run on an ultra-cheap 2GB no-name USB thumb drive:
Ext2 Ext3 Ext4 Reiser3 VFat NTFS Write 434 361 156 750 564 165 Read 50 64 48 87 51 125Your first clue that something is strange? Ext2 and Ext3 change places for write speed! And on this cheap unit, some read speeds go down while write speed go generally up. But Ext4 still clobbers everyone.
Admittedly, this is unfair. All these tests are on a very large set of small files. What happens if you're just copying one large file? Here's the bzipped kernel (one huge file) written to the SD card. Fractions of seconds are shown.
Ext2 Ext3 Ext4 Reiser3 VFat NTFS Write 14.45 11.21 8.67 18.31 8.36 16.08 Read 4.72 4.55 4.66 4.74 4.44 4.48Good news! Since many cameras, phones and other toys must use VFAT it's a relief to see excellent performance when transferring just a few largish lumps. It will lag behind Ext4 when you get up to 20 files or so, but it's still close enough. No need to try to hack your point'n'shoot to read Ext4.
Another extreme example: old systems that only have USB 1.1. Filesystem is irrelevant because the limit is USB bandwidth.