LearnGlossary

What is btrfs? The btrfs filesystem in Linux

Updated 2 November 2026 · Published by Zoorik

btrfs is a copy-on-write (COW) filesystem for Linux, part of the Linux kernel. Instead of overwriting data in place, it writes each change to an unused place on the disk.

Not every Linux distribution ships it. Red Hat removed btrfs in Red Hat Enterprise Linux (RHEL) 8.

The main btrfs features

  • Subvolumes are separate trees of files inside one btrfs filesystem. You can mount each one as if it were its own filesystem, and all of them share its free space.
  • A snapshot is a copy-on-write copy of a subvolume. The two share all their unchanged data, so keeping a filesystem’s history is cheap. btrfs vs LVM compares them with LVM snapshots.
  • btrfs keeps checksums on data and metadata. A scrub reads it all back and verifies the checksums while the filesystem stays mounted. Is btrfs stable in 2026? covers scrub and RAID.
  • A reflink copy shares the same data as its source until one of them changes. btrfs also supports deduplication, and send and receive for incremental backups.

How btrfs compression works

btrfs supports transparent file compression, so apps read and write files as usual. It offers three algorithms: ZLIB, LZO and ZSTD.

The docs’ example turns it on for the whole filesystem, subvolume mounts included:

mount -o compress=zstd /dev/sdx /mnt

With no level given, ZLIB and ZSTD both use level 3. A plain compress with no algorithm means ZLIB. LZO has only one level.

Compression applies only to data written after you turn it on. To compress an existing file, rewrite it with btrfs filesystem defrag -czstd <file>. To compress one file’s future writes, run btrfs property set <file> compression zstd.

Quick checks skip data that won’t compress well. If the first part of a file doesn’t get smaller, btrfs marks the whole file NOCOMPRESS and stops compressing it. The docs advise against compress-force, which tries every block anyway.

Compression needs copy-on-write and data checksums, so the nodatacow and nodatasum options turn it off.

How btrfs grows and shrinks while mounted

One btrfs filesystem can span several disks, with a choice of RAID profiles. It can also grow or shrink in place while it stays mounted.

  • btrfs device add adds a disk to the mounted filesystem. It’s instant, and doesn’t affect the data already there.
  • btrfs device remove moves all the data off the disk first, so it can take a long time. It fails where the profile can’t allow it, such as RAID1 going from two disks to one.
btrfs adds and removes disks while it stays mounted Illustration in two rows, under a legend: violet for data, an outline for empty space, and violet outlined in navy for data moved from disk 3. The top row, Add a disk, runs btrfs device add. Before, disk 1 and disk 2 hold some data. An arrow labelled instant leads to after, where disk 3, added and outlined in navy, joins them empty, and disk 1 and disk 2 hold the same data as before. A note reads existing data doesn’t move. The bottom row, Remove a disk, runs btrfs device remove. Before, disks 1, 2 and 3 all hold data, and disk 3, outlined in navy, is labelled leaving. An arrow labelled its data moves off first leads to after, where disk 1 and disk 2 each hold part of disk 3’s data, and disk 3 is a dashed outline labelled removed. A note under it reads then detach and delete the cloud disk. btrfs adds and removes disks while it stays mounted dataempty spacedata moved from disk 3beforeafterAdd a diskbtrfs device adddisk 1disk 2disk 1disk 2disk 3, addedinstantexisting data doesn’t moveRemove a diskbtrfs device removedisk 1disk 2disk 3, leavingits data movesoff firstdisk 1disk 2disk 3, removedthen detach and delete the cloud disk
Illustration: the fill levels, and how disk 3’s data splits between the other two disks, are not measurements.

Why btrfs matters for your cloud cost

Azure charges a managed disk for its provisioned size, however full it is, and doesn’t support shrinking one. AWS says of Amazon Elastic Block Store (EBS) volumes: “You can’t decrease the volume size.”

So a smaller filesystem alone doesn’t make a smaller disk. With btrfs across several disks, you can empty one while it stays mounted. Then you detach and delete it, and its charge stops.

Amoeba moves the data disks of a virtual machine (VM) onto one btrfs pool sized to your data. It grows the pool before it fills. When your data goes down and stays down, it shrinks the pool one disk at a time.

It works on Azure managed disks and Amazon EBS volumes, on Windows and Linux VMs. It never touches the OS disk or root volume. On Linux, the kernel must support btrfs.

Find your own number

One line in your cloud console. One PDF report with your estimated saving at list price.

Estimate your saving
Talk to the builders

Thirty minutes with the people who build Amoeba.

Book a demo (opens in a new tab)

Or write to founders@zoorik.com