Switch to Btrfs by default

Advantages:

  1. Ability to create system snapshots, in case of a regression in an update it is easy to restore (To date I use Timeshift to create manual snapshots and automatically;
  2. BTRFS COW snapshots do not occupy space initially, they are very fast;
  3. Ability to enable compression, available today: zlib, zstd, lzo;
  4. For some years Btrfs is used by default on openSuse;
  5. Ubuntu already offers a decent default support on Btrfs: create the subvolves of the root and home.
    I’ve been using Btrfs on the Ubuntu desktop for several years (if not badly mentioned by Ubuntu 12.04) without any problem, in fact, I’m very helpful thanks, especially to the snapshots.

Most features are considered mostly “OK”: https://btrfs.wiki.kernel.org/index.php/Status

Since Kernel 5.0 have restored support for the swapfile, used by Ubuntu if you do not create any swap partition: https://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg81923.html

Patch on GRUB to support ZSTD on Btrfs: http://lists.gnu.org/archive/html/grub-devel/2018-10/msg00015.html

My current use of Btrfs on Ubuntu 19.04:
/etc/fstab

9 Likes

Bad idea simply because the benchmarks show that the BTRFS file system performs less well than the EXT4 or ZFS or XFS.

BTRFS is useful for a server but should not be the default for desktop use.

1 Like

I think it’s false, especially compared to zfs, at least based on the phoronix benchmarks.
The desktop use of Btrfs for me is ideal, especially for the ease of the snapshot, then zstd compression is also useful, I have been using it for years and I put Btrfs in all the Ubuntu installations I do for clients, friends, etc. .
openSUSE / SUSE has used Btrfs for years on the root “/”, without any problem, otherwise they would have removed it:
https://lists.opensuse.org/opensuse/2017-02/msg00944.html

https://speakerdeck.com/sysrich/fosdem-2017-how-i-learned-to-stop-worrying-and-love-tumbleweed?slide=50

I also use Btrfs on my 1TB data disc for Steam games and I have no performance problems.

2 Likes

I can’t speak to the technical side; but as an opensuse user btrfs has been somewhat frustrating on tight systems. Technically its been flawless; but the snapshots use space and on old small sdds/hdds (32-40gb) the snapshots fill the space and I’ve ended up with out-of-space problems, where it cannot even delete the snapshots (insufficient space to delete).

I suspect this will create many more [/boot full type] support questions, would require the current 25gb recommended minimum (for desktop, 1.5gb for cli-server etc on https://help.ubuntu.com/community/Installation/SystemRequirements) to be significantly increased in size. Even if wiki’s are changed; I’ve seen many users think 10gb is official recommended minimum because it’s recommended by virtualbox.

This is insignificant maybe, but it’s my experience (on low-end or old hardware)

OpenSuse is a bad example : This distribution is quite slow at startup

Phoronix tests show that BTRFS is not a very efficient file system, the proof here:
https://www.phoronix.com/scan.php?page=article&item=linux-50-filesystems&num=1

If you analyze the results, you will see that with a few exceptions, the BTRFS file system often comes last in terms of performance.

The last tests are here: https://www.phoronix.com/scan.php?page=article&item=bcachefs-linux-2019&num=1
If you compare it with its rivals ZFS and bcachefs, in many cases Btrfs wins.

Consider that Btrfs does not enable any default compression, compared to ZFS which has LZ4 by default and from what I know in many cases it helps performance (correct me if I’m wrong).
You can also enable the “nocow” option for some folders, openSUSE does it on “/ var”:

/var
This directory contains many variable files, including logs, temporary caches, third party products in /var/opt, and is the default location for many virtual machine images and databases. Therefore this subvolume is created to exclude all of this variable data from snapshots and is created with Copy-On-Write disabled.
https://en.opensuse.org/SDB:BTRFS

The main advantage over the classic file systems like ext4, xfs are the snapshots, it has saved me many times over bad updates, I only need one click and I restored my system. Many times I advance to the development version of Ubuntu, and I keep a snapshot of the stable version, if I need it it’s there, ready to restore it, and then go back to the development version again.
The zstd session helps you save a lot of space.

2 Likes

Snapshots do not initially take up space, they increase with the difference between the snapshot and the current volume. If you only keep 2/3 recent snapshots, for example even just 2 weeklies, you won’t have space problems.
It should be the tool with which you snapshot to consider the space and whether it can take the snapshot.
I recently helped a user who had the full disk on Ubuntu and btrfs (use timeshift), he just had to delete the snapshot to make up for space. No problem.
You can also make a balance.

2 Likes

While I do like BTRFS, I’m not sure if it’s inherently useful to transition to as a default for Ubuntu.

  • Features like compression are great, but unlikely to be utilized by the vast majority of Ubuntu users.
  • In regards to snapshots, while they build upon file changes to save space, they do also still require a significant amount of extra space and it becomes an increasingly difficult issue with installs that persist for quite some time. Many users actually upgrade from version to version, and I’ve seen some people with Ubuntu installs over five years old.
  • Performance-wise, BTRFS tends to be faster and more reliable when under heavy load, but I don’t think this edge-case benefit is very compelling for a change that impacts every case.
  • While it is great that openSUSE defaults to BTRFS (it’s a fantastic FS), I don’t think openSUSE’s demographic really reflects even a fraction of Ubuntu’s. Their userbase is not only smaller, but their distro is very server-centric, and this is where BTRFS also shines.

All that being said, I do really like BTRFS and would love to see it used more often… I’d probably be super happy if it did become the default in Ubuntu if I’m honest… I just don’t think it’s something that will happen anytime soon. Although AFAIK BTRFS was supposed to be the successor to Ext3 but it wasn’t ready in time. So there’s certainly some hope.

2 Likes

The problem of snapshot space is true if it occurs if you have a very old snapshot, but:

  1. The snapshots are more useful on the root (/), and here the space is not very expensive, at most 20/30 GB;
  2. You can always remove the old snapshots, if you want more space, the timeshift tool does it automatically, setting a maximum limit of snapshots, for example I have 2 per week.

For example, I have an instant from 2 months ago (created manually) and only takes 2GB.

1 Like

The change of a file system is not easy, btrfs has huge benefits and will eventually replace ext4 but we must be cautious, I recently had a problem with kde baloo file indexing and btrs on kubuntu , the baloo process just kept using ram until it filled and use swap, gigabytes of it, the system hanged, as it was a fresh install I got suspicious about my installation option on formatting the disk partition with btrfs, so I Googled it and found out a bug report with less than a year about a btrfs incompatibility with baloo, something about btrfs dynamic changing some data for some reason I haven lost time in reading it trough,… they got to the conclusion expressed. So there’s lot going on a file system, stability is essencial!

I think it’s a baloo bug, I use Btrfs on Ubuntu, Kubuntu (I prefer Kubuntu on old hardware) and I have never had problems with baloo.
But anyway I think it’s a baloo bug and to report to KDE, I think Btrfs has little to do here.
Aside from that Ubuntu has already decided to go to ZFS, I just hope the Ubuntu team will continue to support Btrfs, at least with the default subvolumes.

1 Like

I would also recommend Btrfs as the default file system in Ubuntu. Tbh, I haven’t noticed any differences (speed wise) between Btrfs and Ext4 and not encountered any issues to date. Have being using Btrfs on Ubuntu for a while now and on all my Ubuntu installations. Timeshift also has to take some of the credit as these two together, work flawlessly. Repairing (restoring) a system, doesn’t get much easier than this and done so quickly (instantly). Timeshift on Ext4 is also very good but takes a little longer (not much) to backup/restore.

:slight_smile: . . .

4 Likes

I have been tracking BTRFS for quite a few years, in fact I had a netbook in 2009 on which my rootfs was running BTRFS.

However making it the default on Ubuntu is a very critical decision and I’d suggest that we should wait for a few of the experimental distros like Fedora to take the leap first.

There is already a desktop use case: openSUSE/SUSE has been using it for a long time by default.
Facebook uses Btrfs in production: https://lwn.net/Articles/824855/

2 Likes

To date my use of Btrfs has evolved, I use a lot of subvolumes to save space on snapshots, not to restore unnecessary folders or applications in case of recovery from a snapshot: https://pastebin.ubuntu.com/p/39NNtQMqQB/

I use ZFS-on-root for my Ubuntu and btrfs-on-root for my Fedora. In addition, I use btrfs in rootless container with podman.

I think it depends on how many man-hours can be contributed to btrfs by kernel developers in Ubuntu community. SuSE, Facebook and Red Hat all have such resources and when they encounter a btrfs issue, some one can hop in ASAP.

Zsys by Canonical is really nice and it saved me several times from sound system failure (I have to use Microsoft Teams frequently on my Ubuntu machine). If we can integrate btrfs into Zsys, then btrfs-on-ubuntu-root will come soon.

Another missing feature from btrfs is recursive snapshot. Zsys right now uses this feature to create full bpool and rpool snapshots. We need a way to bypass that on btrfs.

1 Like

I tried to do fio on ZFS, XFS, ext4 and btrfs, I don’t know why btrfs is way slower, while it is reasonable fast as my root file system on Fedora.

You can configure snapper to manage multiple subvolumes and restore the snapshot selectively.
http://snapper.io/manpages/snapper-configs.html

1 Like

BTRFS is great fs. And will ( and probably already have) outperform ZFS. Not to mention, BTRFS’s GPL license and big tech company developers contributing on it.

I’ve been using BTRFS for a couple of year now.
I many respects it is a bit slow, but it’s worth that for it’s checksumming features.

What isn’t so great is that you need to keep an eye on it.
You need to run disk IO intensive re-balancing operations to release unused allocations back to free space.
Otherwise, if you have storage that gets over roughly 80% full you can unexpectedly run out of free space (even though it doesn’t look that way with say df).