ArticleslgStudy

computer science

Btrfs

Btrfs is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Btrfs rather than just read about it. In short: Btrfs (pronounced as "better F S", "butter F S", "b-tree F S", or "B.T.R.F.S.") is a computer storage format that combines a file system based on the copy-on-write (COW) principle with a logical volume manager (distinct from Linux's LVM), developed together. It was created by Chris Mason in 2007 for use in Linux, and since November 2013 (Linux 3.13), the file system's on-disk format has been declared stable in the L…

Btrfs — main illustration
Btrfs — illustration

Key takeaways

  • Btrfs belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Btrfs to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Btrfs from memory before moving on to harder problems.

Reference excerpt

Btrfs (pronounced as "better F S", "butter F S", "b-tree F S", or "B.T.R.F.S.") is a computer storage format that combines a file system based on the copy-on-write (COW) principle with a logical volume manager (distinct from Linux's LVM), developed together. It was created by Chris Mason in 2007 for use in Linux, and since November 2013 (Linux 3.13), the file system's on-disk format has been declared stable in the Linux kernel. Btrfs is intended to address the lack of pooling, snapshots, integrity checking, data scrubbing, and integral multi-device spanning in Linux file systems. Mason, the principal Btrfs author, stated that its goal was "to let [Linux] scale for the storage that will be available. Scaling is not just about addressing the storage but also means being able to administer and to manage it with a clean interface that lets people see what's being used and makes it more reliable".

History

The core data structure of Btrfs‍—‌the copy-on-write B-tree‍—‌was originally proposed by IBM researcher Ohad Rodeh at a USENIX conference in 2007. Chris Mason, an engineer working on ReiserFS for SUSE at the time, joined Oracle later that year and began work on a new file system based on B-trees. In 2008, the principal developer of the ext3 and ext4 file systems, Theodore Ts'o, stated that although ext4 has improved features, it is not a major advance; it uses old technology and is a stop-gap. Ts'o said that Btrfs is the better direction because "it offers improvements in scalability, reliability, and ease of management". Btrfs also has "a number of the same design ideas that reiser3/4 had". Btrfs 1.0, with finalized on-disk format, was originally slated for a late-2008 release, and was finally accepted into the Linux kernel mainline in 2009. Several Linux distributions began offering Btrfs as an experimental choice of root file system during installation. In July 2011, Btrfs automatic defragmentation and scrubbing features were merged into version 3.0 of the Linux kernel mainline. Besides Mason at Oracle, Miao Xie at Fujitsu contributed performance improvements. In June 2012, Mason left Oracle for Fusion-io, which he left a year later with Josef Bacik to join Facebook. While at both companies, Mason continued his work on Btrfs. In 2012, two Linux distributions moved Btrfs from experimental to production or supported status: Oracle Linux in March, followed by SUSE Linux Enterprise in August. In 2015, Btrfs was adopted as the default file system for SUSE Linux Enterprise Server (SLE) 12. In August 2017, Red Hat announced in the release notes for Red Hat Enterprise Linux (RHEL) 7.4 that it no longer planned to move Btrfs to a fully supported feature (it's been included as a "technology preview" since RHEL 6 beta) noting that it would remain available in the RHEL 7 release series. Btrfs was removed from RHEL 8 in May 2019. RHEL moved from ext4 in RHEL 6 to XFS in RHEL 7. In 2020, Btrfs was selected as the default file system for Fedora 33 for desktop variants.

Features

List of features

Implemented As of version 6.0 of the Linux kernel, Btrfs implements the following features:

Mostly self-healing in some configurations due to the nature of copy-on-write Online defragmentation and an autodefrag mount option Online volume growth and shrinking Online block device addition and removal Online balancing (movement of objects between block devices to balance load) Offline file-system check Online data scrubbing for finding errors and automatically fixing them for files with redundant copies RAID 0, RAID 1, and RAID 10 Subvolumes (one or more separately mountable file-system roots within each disk partition) Transparent compression via zlib, LZO and (since 4.14) ZSTD, configurable per file or volume Atomic writable (via copy-on-write) or read-only snapshots of subvolumes File cloning (reflink, copy-on-write) via cp --reflink <source file> <destination file> Checksums on data and metadata (CRC-32C). New hash functions are implemented since 5.5: xxHash, SHA256, BLAKE2B. In-place conversion from ext3/4 to Btrfs (with rollback). This feature regressed around btrfs-progs version 4.0, rewritten from scratch in 4.6. Union mounting of read-only storage, known as file system seeding (read-only storage used as a copy-on-write backing for a writable Btrfs) Block discard (reclaims space on some virtualized setups and improves wear leveling on SSDs with TRIM) Send/receive (saving diffs between snapshots to a binary stream) Incremental backup Out-of-band data deduplication (requires userspace tools) Ability to handle swap files and swap partitions

Implemented but not recommended for production use Hierarchical per-subvolume quotas RAID 5, RAID 6 (fail to guard against write holes)

Cloning Btrfs provides a clone operation that atomically creates a copy-on-write snapshot of a file. Such cloned files are sometimes referred to as reflinks, in light of the proposed associated Linux kernel system call. By cloning, the file system does not create a new link pointing to an existing inode; instead, it creates a new inode that initially shares the same disk blocks with the original file. As a result, cloning works only within the boundaries of the same Btrfs file system, but since version 3.6 of the Linux kernel it may cross the boundaries of subvolumes under certain circumstances. The actual data blocks are not duplicated; at the same time, due to the copy-on-write (CoW) nature of Btrfs, modifications to any of the cloned files are not visible in the original file and vice versa. Cloning should not be confused with hard links, which are directory entries that associate multiple file names with a single file. While hard links can be taken as different names for the same file, cloning in Btrfs provides independent files that initially share all their disk blocks. Support for this Btrfs feature was added in version 7.5 of the GNU coreutils, via the --reflink option to the cp command. In addition to data cloning (FICLONE), Btrfs also supports out-of-band deduplication via FIDEDUPERANGE. This functionality allows two files with (even partially) identical data to share storage.

Subvolumes and snapshots

… excerpt ends here. Continue reading the full article.

Illustrations

Btrfs: Screenshot of usage information of a Btrfs file system
Screenshot of usage information of a Btrfs file system
Btrfs: Example of listing of subvolumes of a Btrfs file system, including snapshots
Example of listing of subvolumes of a Btrfs file system, including snapshots
Btrfs: Example of snapshots of a Btrfs file system, managed with snapper
Example of snapshots of a Btrfs file system, managed with snapper
Btrfs: Example of Btrfs quota groups
Example of Btrfs quota groups

Worked examples

Example 1 — a first encounter with Btrfs

Start with the simplest possible case. Write down what Btrfs claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Btrfs before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Btrfs ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Btrfs

In research
Btrfs appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Btrfs in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Btrfs is common in secondary-school and first-year university syllabi. It links to neighbouring topics Compression file systems, Disk file systems, File systems supported by the Linux kernel, so understanding it makes those chapters shorter.
In everyday life
Look for Btrfs outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Btrfs” →

How to study Btrfs in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Btrfs means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Btrfs out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Btrfs in simple terms?

Btrfs (pronounced as "better F S", "butter F S", "b-tree F S", or "B.T.R.F.S.") is a computer storage format that combines a file system based on the copy-on-write (COW) principle with a logical volume manager (distinct from Linux's LVM), developed together. It was created by Chris Mason in 2007 fo…

Why does Btrfs matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Btrfs?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Btrfs.

Tags

  • Compression file systems
  • Disk file systems
  • File systems supported by the Linux kernel
  • Linux file system-related software

Keep exploring