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?
- Compression: No decrease in speed, but 55% decrease in space, 22GB -> 10GB!
- Modern code design
- Built into Linux (the kernel)
- Fault tolerance (insane! checksums and avoiding silent data-corruption)
- As easy to set up as ext4
(
mkfs.btrfs /dev/sdx1 -L "My Better filesystem label"
) - Cheap copies (backups and snapshots)
- Subvolumes (what is this?)
- Quotas for subvolumes
- Software raid
- Conversion from ext4 (with revert)
- Backups / snapshots
- Great resizing capabilities
- More space-efficient than ext4 (26.38MB vs 128KB for a 512MB partition)
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