arch btrfs

btrfs as rootfs on arch

SEAN K.H. LIAO

arch btrfs

btrfs as rootfs on arch

btrfs

You've decided to stick your fingers in your ears, ignoring all claims of instability and use btrfs as your root filesystem. You want a subvolume as /.

notes: btrfs subvolumes is best thought of as lightweight namespaces, you mount the same partition for all (sub)volumes and you specify the subvolume as a mount option.

hardware

tested on a dell xps9350: uefi, nvme ssd

steps

  1. create paritions:
    1. EFI partition
    2. root partition
  2. create filesystems
    1. mkfs.fat -F 32 /dev/nvme0n1p1
    2. mkfs.btrfs /dev/nvme0n1p2
  3. setup btrfs, because btrfs is just a (heirarchical) set of namespaces, we mount the btrfs root, create our subvolumes, then unmount it, then remount the ones we actually need. Alternatively you can mount the btrfs root elsewhere during setup, eg /btrfs.
    1. mount -o compress=zstd /dev/nvme0n1p2 /mnt
    2. mkdir /mnt/arch
    3. btrfs subvolume create /mnt/arch/@, the @ is just a naming convention
    4. btrfs subvolume create /mnt/arch/@home
    5. umount /mnt
  4. mount filesystems, where they will end up in your final system
    1. mount -o compress=zstd,subvol=arch/@ /dev/nvme0n1p2 /mnt
    2. mkdir /mnt/boot
    3. mount /dev/nvme0n1p1 /mnt/boot
    4. mkdir /mnt/home
    5. mount -o compress=zstd,subvol-arch/@home /dev/nvme0n1p2 /mnt/home
  5. timedatectl set-ntp true
  6. iwd station wlan0 connect $network
  7. reflector --save /etc/pacman.d/mirrorlist -f 5 -p https
  8. pacstrap /mnt base base-devel linux linux-firmware intel-ucode btrfs-progs zsh zsh-completions iwd git neovim, minimal set of things to work comfortable after reboot
  9. genfstab -U /mnt >> /mnt/etc/fstab
  10. arch-chroot /mnt
  11. passwd
  12. bootctl install
  13. echo "default arch\ntimeout 0\nconsole-mode max" > /boot/loader/loader.conf
  14. create loader entry, see below
  15. continue after rebooting into new system, some tools require the right systemd/dbus setup not available in chroot.

bootloader

The dell xps9350 has a shitty firmware that apparently doesn't pass the kernel cmdline properly(?) so systemd-boot is used

1title   Arch Linux
2linux   /vmlinuz-linux
3initrd  /intel-ucode.img
4initrd  /initramfs-linux.img
5options root=UUID=.... rootflags=compress=zstd:3,subvol=arch/@,... quiet rw