Mount the filesystems
Now assemble the subvolumes into the directory tree that the new
system will see, rooted at /mnt.
Pick the mount options once:
OPTS="noatime,compress=zstd:1"
noatime stops the filesystem from writing an access timestamp every
time a file is read, which is a pure write amplification with
almost no upside on a workstation. compress=zstd:1 compresses data
transparently; level 1 is deliberate, because btrfs compression is
fast enough at low levels to be effectively free, while higher levels
cost noticeably more CPU for a few percent more space.
Mount everything
mount -o "$OPTS,subvol=@" "$ROOTDEV" /mnt
mkdir -p /mnt/{home,.snapshots,var/log,var/cache/pacman/pkg,swap,boot}
mount -o "$OPTS,subvol=@home" "$ROOTDEV" /mnt/home
mount -o "$OPTS,subvol=@snapshots" "$ROOTDEV" /mnt/.snapshots
mount -o "$OPTS,subvol=@log" "$ROOTDEV" /mnt/var/log
mount -o "$OPTS,subvol=@pkg" "$ROOTDEV" /mnt/var/cache/pacman/pkg
mount -o "noatime,subvol=@swap" "$ROOTDEV" /mnt/swap
mount "$ESP" /mnt/boot
Order matters: @ has to be mounted first, because the mkdir that
follows creates the mount points inside it, and each later mount
lands on one of those directories.
@swap is mounted without compress, deliberately. A swapfile has
to be a plain, uncompressed, un-copy-on-write extent, and giving the
subvolume compressed mount options would conflict with that.
Check it
findmnt -nR /mnt -o TARGET,SOURCE,FSTYPE
/mnt /dev/mapper/cryptroot[/@] btrfs ├─/mnt/home /dev/mapper/cryptroot[/@home] btrfs ├─/mnt/.snapshots /dev/mapper/cryptroot[/@snapshots] btrfs ├─/mnt/var/log /dev/mapper/cryptroot[/@log] btrfs ├─/mnt/var/cache/pacman/pkg /dev/mapper/cryptroot[/@pkg] btrfs ├─/mnt/swap /dev/mapper/cryptroot[/@swap] btrfs └─/mnt/boot /dev/nvme0n1p1 vfat
Seven lines, with the subvolume in brackets after each source. If one
is missing, or two targets show the same subvolume, fix it now –
this tree is exactly what gets written into /etc/fstab in the next
chapter, and a mistake here becomes a system that does not boot.
Without LUKS the SOURCE column shows the partition
(/dev/nvme0n1p2[/@]) rather than /dev/mapper/cryptroot.
Everything else is identical.