Debian is one of my favorite distributions. The installer leaves a little to be desired with setting up BTRFS and LUKS. This tutorial is designed to walk you through the steps of setting up LUKS and BTRFS with subvolumes.
For this part you will need Debian installation medium. The process is pretty simple but you will use the expert Install instread of the normal install.
This will launch the text based Debian installer.
In this section we will setup the basic encrypted volume and setup the base BTRFS file system.
This is the most complicated part of the install. Do not continue the noromal install process until you complete this part. These are manual steps that have to be completed from outside the installer. In my case the drive I used is nvme0n1p. This may be different on your system so please repalce that.
umount /target/boot/efi
umount /target/boot
umount /target
mount /dev/mapper/nvme0n1p3_crypt /mnt
cd /mnt
btrfs subvolume create @
btrfs subvolume create @home
btrfs subvolume create @var
btrfs subvolume create @snapshots
mount -o ubvol=@ /dev/mapper/nvme0n1p3_crypt /target
mkdir -p /target/{home,var,snapshots}
mount -o subvol=@home /dev/mapper/nvme0n1p3_crypt /target/home
mount -o subvol=@snapshots /dev/mapper/nvme0n1p3_crypt /target/snapshots
mount -o subvol=@var /dev/mapper/nvme0n1p3_crypt /target/var
mkdir /target/boot
mount /dev/nvme0n1p2 /target/boot
mount /dev/nvme0n1p1 /target/boot/efi
mkdir /target/etc
cp /mnt/@rootfs/etc/fstab /target/etc
cp /mnt/@rootfs/etc/crypttab /target/etc/crypttab
nano /target/mount/etc/fstab
Replace your root entry and add the neccessary entries like below.
/dev/mapper/nvme0n1p3_crypt / btrfs defaults,subvol=@ 0 0
/dev/mapper/nvme0n1p3_crypt /home btrfs defaults,subvol=@home 0 0
/dev/mapper/nvme0n1p3_crypt /var btrfs defaults,subvol=@var 0 0
/dev/mapper/nvme0n1p3_crypt /snapshots btrfs defaults,subvol=@snapshots 0 0
rm -rf /mnt/@rootfs/etc /mnt/@rootfs/media /mnt/@rootfs/boot
umount /mnt
From here is a normal Debian install. Continue on as you would any other install.
See next part of this series for adding luks with fido2 on debian