Oct 312011
 

Is it possible to get excited about a technology we never notice when using a computer? File systems do their job and we never give them a second thought. On a fresh setup of Ubuntu 11.10 I have 10 different mkfs.* binaries, allowing the creation of as many file systems. Why is there more than one? Let’s take a look at one I find truly exciting: btrfs, the newest entry in the Linux file system zoo.

What is it?

Btrfs is a file system designed to handle large amounts of data. It is capable of organizing volumes of up to 16 EiB and supports a maximum file size of 16 EiB. To ensure a consistent file system state, it uses copy-on-write, meaning it writes data to new locations and then updates the entry in the file system trees, so the changes only become visible once they have been completed. As a comparison: ext4 (which is the newest update of the ext-family of file systems traditionally used on Linux) supports 1 EiB volumes (1/16) and 16 TiB file sizes (1/2^20). And ext4 is a journaling file system. It records changes to be made before making them so the system state can be restored in the event of a crash.

btrfs also has a few interesting new features, which we will take a look at in a minute after having a look at how the development of btrfs started.

In 2004, Sun made waves with their ZFS file system for Solaris. It provided many new capabilities, which were not available in production-grade file systems at the time. Examples include 16EB maximum file size, copy-on-write and data dedublication. It was opensourced as part of OpenSolaris and eventually ported to linux, although never included due to license incompatibilities. Probably in response, Oracle’s Chris Mason announced btrfs, its own new copy-on-write file system capable of storing 16 EiB files and supporting similar features like snapshots in 2007. Ironically, Oracle acquired Sun in 2010.
By now this new file system is bundled in all major Linux distributions (since Debian 6.0, Ubuntu 10.10 and Fedora 13 (this was the earliest mention I found, maybe even earlier). Fedora plans to eventually use btrfs as their default file system.

New features

The original announcement listed 12 features as implemented or to do. Let me highlight some of the more exciting ones:

  • snapshots
  • Since btrfs is a copy-on-write file system, it can keep trees representing the state at an earlier time around without any additional copying. This feature can be used to implement proper “safe points” to restore a system in case something goes wrong. No more booting of life systems and manual restoring of backups!

  • storage mode for SSDs
  • New computers often come with solid state disks, which are faster to read and write, allow random access, but have a smaller number of write cycles. These properties can be used and taken into account by choosing a different strategy for identifying disk space to allocate on write. Phoronix has compared the write speed of SSD drives using btrfs in both the normal and SSD mode.

  • file system based RAID
  • Or rather RAID-like features. Specifically, btrfs currently supports distributing file systems over more than one physical disk (like RAID0) and duplication (like RAID1).

  • subvolumes
  • Similar to snapshots, subvolumes allow the same data store to be used for several file systems. In essence, the same file system can have more than one root directory in the same disk space.

I for one am very excited about snapshots, but can imagine all of those features to come in handy in the future. Check out the btrfs wikipedia article, which lists those features with links to helpful articles inside its enormous repository of knowledge.

Status

btrfs is still not considered stable and there are some very exciting features forthcoming. One notable omission is that of a file system check utility. btrfs-fsck can currently detect errors in the file system, but not fix them yet. After some delays, this functionality is supposed to be released real soon now. Oracle plans to use btrfs as their default file system in Oracle Linux, which makes this tool a necessity.

I have used btrfs on the storage partition of my laptop since the release of Ubuntu 11.10 and have not had any issues. (However, making the boot partition btrfs failed with boot issues. Not unresolvable, but not a priority of mine at the time.) Additionally, I have upgraded the default ext4 root partition on a fresh Fedora 16 beta release to btrfs using the btrfs-convert tool from btrfs-progs. (Doing it this way is quite risk-free. The tool will keep your ext-data around so you can restore your previous state. As usual, backups are a good idea when playing with new stuff. Don’t forget to update the affected partitions’ UUIDs (use blkid to determine the current value), which will be changed by the conversion. /etc/fstab and the boot loader come to mind.)

Summary

btrfs is a new Linux file system. It has many exciting new features and is already stable enough to be used on non-critical systems. When the integration with tools on Linux-based systems improves we will see some exciting new capabilities coming to these systems. Currently, Fedora integrates snapshots into GRUB to realize proper system rollbacks. Expect this and more features to get picked up by the other distributions.

We are not going to notice much of it in normal operation, but we can rest easy in the knowledge that btrfs manages our exbibytes for us.

Guest post by Markus Mauder.

 Leave a Reply

(required)

(required)


(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">