Skip to content

pmb.install: more comprehensive btrfs subvol handling

Jacob Ludvigsen requested to merge papiris/pmbootstrap:flat-btrfs-layout into master

Why Btrfs has some goodness (snapshots, switching between different rw snapshot) which plays particularly well with certain "subvolume layouts".

What This MR seeks to implement such a layout, namely a flat btrfs layout, where the top level subvolume (i.e. the btrfs filesystem/partition itself) remains unmounted in all situations except when making changes to direct child subvolumes of the filesystem.

  • rename all subvols to follow the common @* btrfs subvol naming scheme.
  • add subvol @root, because roots home directory shouldn't be rolled back.
  • make subvol @var not Copy-on-Write (nodatacow) to avoid write multiplication on logs, VMs, databases, containers and flatpaks.
  • add subvol @snapshots because that lets us change the root subvol to a read-write snapshot of @ without affecting snapshots.
  • add subvol @srv because it contains data for Web and FTP servers, which shouldn't roll back together with root subvol.
  • add subvol @tmp because we don't want to snapshot temporary files. This subvol remains unmounted on the device, unless conditions as laid out in pmaports!4737 are met.
Edited by Jacob Ludvigsen

Merge request reports