Ubuntu 20.04 + btrfs + mirrored drives

I run a Linux machine at home. It’s mostly a server, although sometimes I use it as a desktop. I use it for SSH, samba, and I have apache hosting family photos. The photos sit on a secondary drive, and lately it manifest sector errors. Some of photos were no longer accessible.

Fortunately, I have a backup on an external hard drive. Thank goodness for backups!

I decided that it was time to upgrade to Ubuntu 20.04. This time, I wanted mirrored drives with a file system that detects silent data corruption 2.

I started with btrfs, partitioned my first drive and installed Ubuntu. But wait? Should I have chosen ZFS?

ZFS is a first class citizen in Ubuntu, and is reportedly rock solid. The documentation is good.

In contrast, it takes some searching to find good btrfs documentation, and some of the documentation refers to scary features that might eat your data — not comforting. Yet Facebook uses btrfs, so that’s good, right? On the other hand, they have people whose job it is to use it for the right use cases, and configure it appropriately. I don’t.

Oh, and there’s bcachefs! It sounds great, and is reportedly faster, more modern than btrfs or ZFS, and more reliable that btrfs. Unfortunately, it’s not part of most Linux distributions yet, nor is it feature complete. I’ll look forward to using it in three to five years.

Ultimately, I chose btrfs because it doesn’t require that I dedicate the entire hard drive, and because I already had some momentum having started my install with it.

I found the following guide to be helpful to set up btrfs in mirrored mode: https://work-work.work/blog/2018/12/01/ubuntu-1804-btrfs.html

Arch has good documentation for btrfs: https://wiki.archlinux.org/index.php/Btrfs

Update Sept, 2021: Ars Technica has a review of the many sharp edges (i.e. dangers) of using Btrfs. Among other things, the author, Jim Salter, says:

Btrfs’ refusal to mount degraded, automatic mounting of stale disks, and lack of automatic stale disk repair/recovery do not add up to a sane way to manage a “redundant” storage system.

Regardless, it’s what I’ve been using, and the data healing part of btrfs reportedly works well. I’d rather not go through a “tortuous” recovery in a future day, but at least I’ve linked to the article, and will reference it when that day comes.


Once Ubuntu was installed, it took hours to add missing packages, reconfigure software and restore from backup. Here’s some of what I installed:

sudo apt-get install meld screen jhead socat apache2 zsh tree tcpdump zip xz-utils zsh vlc ffmpeg samba fail2ban mutt curl strace git ruby rsync python3-virtualenv fetchmail procmail postfix openssh-server netcat-openbsd lsof gwenview dnsutils dosfstools build-essential htop silversearcher-ag mailutils vim-gtk3 at fetchmail