Butter FS or Z file system?

Why I recommend BTRFS over ZFS in 2023: it is more stable and consumes less ram.

Butter FS or Z file system?
Photo by Sorin Gheorghita / Unsplash

Looking for a simple backup for my drives let me purchase a cheap high capacity drive from my local reseller. High capacity in twenty-three still includes the 16TB drive that I got.

Summary for those short on time: ZFS seems to be more fancy, but eats ram like chocolate cookies. BTRFS seems to be consuming a little more cpu but runs stable on my old take-out-gpu-to-convert-from-workstation server. 

Sure I could use ext4, but looking at what is out there got me exited. Those next generation file systems look sexy with all the features they offer: flexible redundancy options, self-healing capabilities, all through an easy to use interface.

Skim reading through a couple of articles I quickly got the impression that ZFS was liked/hyped more. Even my beloved LXD seems to have switched over recently. So I tested that first.

sudo apt install zfsutils-linux
sudo zpool create <pool_name> <drive_name>
rsync -av <source> <destination>
install zfs, make a pool and start the backup

Unfortunately everything would hang after one to three hours. It used 12 of my 16GB ram during copying, and around 4 for only reading from the drive. I could not quickly determine the reason for hanging, but whatever, there was still BTFS to test.

sudo zpool destroy <pool_name>
sudo apt install btrfs-progs -y
sudo mkfs.btrfs -L <your_name> <drive_name> -f
rsync -av <source> <destination>
get rid of the zpool, and format the drive with BTRFS, start the backup

Here, -f is for "force". Because ZFS left its partitions on the drive, we need this flag to let btrfs overwrite them with new partition data.

Now everything is running smoothly with just consuming 4GB of ram with ubuntu and some containers running in the background. So far it did not hang, seems to be running smooth as butter, so this is what I recommend for the time being!

And with enough ram left, I could even spin up spigotMC again for the boys, in case their parents award them playtime in the afternoon.


Update: You need BTRFS to run docker inside LXD.

I wanted to quickly test some docker containers, but since I have everything in containers, I wanted docker to be tucked away as well. Not that this makes much sense.

So we need to make a new storage pool and move our container to it.

sudo lxc storage create <new_pool_name> btrfs
sudo lxc stop <your_container>
sudo lxc move <your_container> <your_container-temp> -s <new_pool_name>
#rename it back if you want to keep the same name:
sudo lxc move <your_container-temp> <your_container>
sudo lxc start <your_container>

Also, don't forget to run these three commands:

sudo lxc config set <your_container> security.nesting=true
sudo lxc config set <your_container> security.syscalls.intercept.mknod=true
sudo lxc config set <your_container> security.syscalls.intercept.setxattr=true

Now docker should run and work fine. Without BTRFS, it would not properly create a database, and hence the app I wanted to try would not run.

I suspect it is only a matter of time before docker supports ZFS properly, but for now it is what it is.

Also, check out this really interesting discussion about why ZFS in LXD.