Home
Articles
APIs
Kvarn
DNS
httPWM

See the YouTube video.

Contents
1 Introduction
2 Why?
3 Convert
4 Mount options
5 Sidenote: enlarge LUKS partition
6 Summary

Introduction

As with all things on Linux, you have plenty of options. I’ve done the research, and concluded the Better filesystem (BTRFS) is the best for Linux.

This article will cover the code to getting started, including how to convert from Ext4.

Why?

Convert

I use doas, as it’s not as bloated as sudo. You can naturally replace doas with sudo or equivalent (I dunno, pkexec, maybe?)

$ doas umount /dev/sdc1

$ doas e2fsck -fvy /dev/sdc1

# UUID copy does not seems to work. You have to edit your fstab to correct the change.
$ doas btrfs-convert -L --uuid new /dev/sdc1

Edit fstab (new UUID, noatime, compress=zstd, autodefrag)

$ doas mount /dev/sdc1 /misc

Check if file system is ok

# You cannot revert. Use `btrfs-convert -r /dev/sdc1` to rollback BEFORE this command.
$ doas btrfs subvolume delete /misc/ext2_saved

# This compresses the whole filesystem with zstd
$ doas btrfs filesystem defrag -v -r -f -t 32M -czstd /misc

# Reclaims the Ext4 space
$ doas btrf