Storage / Technology

An Introduction to New Linux Filesystem bcachefs

17 Sep 2019 1:11pm, by

If you’ve worked with Linux long enough, you’ve probably experienced many of the various types of filesystems to be had. When I first started with Linux (back in ‘97), the selection of filesystems was mostly limited to ext2. Now there’s ext4, btrfs, ZFS, xfs, jfs, and more. That’s a lot of options — especially considering the likes of Windows and macOS tend to only have one option available.

There is, of course, yet another option on the rise. This new filesystem, created by Kent Overstreet, is called bcachefs. Bcachefs is a Copy On Write (COW) filesystem, which places a premium on reliability and robustness. The feature list for bcachefs is impressive:

  • Full data and metadata checksumming
  • RAID support
  • Caching
  • Tiering/writeback compression
  • Replication
  • Encryption
  • Snapshotting
  • Scalable (tested to 50+ TB)
  • And much more.

Why Bother?

Although bcachefs is relatively new, it’s quite stable, and already has a growing community of users. But the big question that might well come to the fore of every Linux user’s mind is, “Why bother?” According to Overstreet, “bcachefs’s huge advantage is that bcache already was the bottom half of a filesystem — and it was fast, stable, and had a user base large enough to prove that, and a test suite that could exercise any changes to the existing functionality that were made for filesystem support.”

NOTE: Bcache is a cache system in the Linux kernel block layer used for accessing secondary storage devices, and allows one or more fast storage devices (such as SSDs) to act as a cache for slower devices (such as old-school HDs).

The biggest reason for bringing bcache into existence was to create a filesystem with a feature set to rival that of ZFS and btrfs, while enjoying the performance of the ext4 filesystem. That’s no easy feat, but it’s one that Overstreet is getting close to accomplishing. According to the latest Phoronix bench testing, bcachefs still has a ways to go, but it’s showing promise. In fact, depending on the test, bcachefs can already outshine a number of other file systems.

Overcoming Tail Latency

Also, according to Overstreet, what benchmarks don’t  show is “…that bcachefs is very much designed with tail latency in mind.” What is tail latency? Typically, in large-scale systems, data is spread across a number of storage devices. When a user or service requests data, said data is requested in bits and pieces from across the entire system. After that request, there is a (very brief) wait for a response. The slowest drive to respond to the request causes a delay in the response. That delay is tail latency.

The bcachefs filesystem attempts to overcome tail latency. According to Overstreet, “In bcachefs, the only reason a thread blocks on IO is because it explicitly asked to (an uncached read or an fsync operation), or resource exhaustion — full stop.”

Overcoming tail latency would be quite the boon to cloud computing. In their paper TailCutter: Wisely Cutting Tail Latency in CloudCDN under Cost Constraints, Zeqi Lai, Yong Cui, Minming Li, Zhenhau Li, Ningwei Dai, and Yuchi Chen stated, “The impact of high latency variance is problematic for popular applications where even 1% of traffic corresponds to a significant volume of user requests, and for applications where the user is required to download several objects…”

With tail latency a problem, cloud implementations could suffer under the weight of delay … especially when at scale. Consider millions of users requesting objects, only to have those requests delayed by the weakest link in the storage chain. Bcachefs could overcome that issue.

Could being the operative term. Since this new filesystem is still very much in beta, it’s a challenge to test.

Speaking of which …

Is It Ready?

No. Although it is possible to get bcachefs installed on a system, it’s a rather complicated process and the filesystem isn’t completely ready for production. Although many of the features are 100% implemented, some features are still very much in development. Some of those features and their status include:

  • Replication is 80% complete.
  • Erasure encoding has yet to be started.
  • Encryption has yet to be started.
  • Snapshots is in progress.
  • PMEM support has yet to be started.
  • Reflink (using shared, reference-counted extends for shallow copies) was officially completed, as of August 21, 2019.

So clearly, bcachefs isn’t ready for primetime. That’s quite understandable, as this new filesystem is being developed only by Overstreet. Even the documentation for bcachefs is, at the moment, quite minimal.

If You Want to Try

If you’re of the daring sort (and you have a good amount of time to spare), you can always test bcachefs. To do this you’ll need to jump through a few hoops (one of which is to compile a kernel). Do NOT do this on a production machine. Use either a virtual machine or a spare server or desktop for the testing of bcachefs.

I successfully tested bcachefs on Ubuntu Server 18.04 with the following steps:

Install the necessary dependencies with the following command:

Clone the bachefs and bcachefs-tools sources with the commands:

Build the bcachefs userspace utility with the following commands:

Copy the current kernel config with the command:

Where XXX is the kernel release on your system.

It’s now time to configure the kernel. Change into the bcachefs directory with the command:

Now issue the command:

This is the portion of the installation that will take considerable time. You’ll have to answer a LOT of questions. Pay close attention near the end, as that is when you are able to enable bcachefs support (Figure 1).

Figure 1

Enabling bcachefs support in the kernel.

Once this completes, build the kernel with the command:

Again, the above step will take considerable time. Once it completes, install your new kernel with the following commands:

Where X is the release number of the compiled kernel. When the above command completes, you can reboot into the newly compiled kernel and give bcachefs a try by creating a new partition and then running the command:

Where XXX is the name of the newly-created partition.

Once that is complete, you can then create your mount points, add an fstab entry, mount the newly created partition, and experience the bcachefs filesystem. Just make sure you report any discovered bugs to the developer.

Feature image via Pixabay.

A newsletter digest of the week’s most important stories & analyses.

View / Add Comments

Please stay on topic and be respectful of others. Review our Terms of Use.