Btrfs for the Pi

Btrfs for the Pi

File systems are one of those things that typical end users don’t think much about. Apparently, [seaQueue] isn’t a typical end user. He’s posted some instructions on how to run an alternate file system–btrfs–on the Raspberry Pi.


The right file system can make a big difference when it comes to performance and maintainability of any system that deals with storage. Linux, including most OSs for the Raspberry Pi, uses one of the EXT file systems. These are battle-hardened and well understood. However, there are other file systems, many of which have advanced features superior to the default file system for some applications.


Btrfs, often pronounced “butter eff ess”, begin life at Oracle and was born from an idea in an IBM paper. It offers advanced features like pooling, snapshots, and the ability to fuse multiple devices into one logical device. One notable feature the file system offers is copy-on-write. That means file copies can share common blocks as long as they stay common.  Compression is available, as is seeding a file system with read-only storage, which could be very useful in some embedded systems. You can also configure several types of RAID using nothing but btrfs. You can see a video presentation about features of btrfs below.



The post by [seaQueue] suggests an 8 GB SD card, although you can apparently barely squeeze onto a 4 GB card. He also points out that btrfs doesn’t support swap files (but you can create a dedicated swap partition) and that certain workloads can cause a lot of writes which might be bad for SD cards and other solid state storage. He suggests you could use an SSD instead of an SD card or USB drive, and this apparently offers better wear leveling.


Do you need this kind of power on a Raspberry Pi? Maybe not. But it is still a good tool to have at your disposal. We can imagine systems where being able to span multiple volumes, do snapshots for backups, and implement RAID could come in handy.


If you’d rather hack your own file system, that’s possible too. A whole file system is a big job, but with FUSE you can create simple file systems that do things like front for an ssh connection or a compressed archive file. The original Unix philosophy was that everything should be a file. Modern developers have moved away from that to some degree, but you still see occasional examples.



Filed under: linux hacks, Raspberry Pi