- With Ubuntu 24.04 it's not longer possible to setup FDE with BTRFS
- The new installer won't offer you any options for manually created dm-crypt volumes
- They move to a TPM-backed solution with a GRUB snap package Show archive.org snapshot
- Alternatives are LVM and encryption on
ext4
or ZFS with encryption (experimental) - Another alternative is a proper Linux distribution Show archive.org snapshot
Caution
Only continue if you're a real BTRFS ultra fan.
Manual BTRFS setup
- Boot Ubuntu 24.04 Desktop
- Go to
Disk setup
->Erase disk and install Ubuntu
->Advanced features
- Pick
Use LVM and encryption
- It will setup such a layout
nvme0n1 259:0 0 931.5G 0 disk ├─nvme0n1p1 259:1 0 1G 0 part /boot/efi ├─nvme0n1p2 259:2 0 2G 0 part /boot └─nvme0n1p3 259:3 0 928.5G 0 part └─dm_crypt-0 252:0 0 928.4G 0 crypt └─ubuntu--vg-ubuntu--lv 252:1 0 928.4G 0 lvm /
- Reboot
- Install BTRFS tools:
apt install btrfs-progs
- Set filesystem type to
auto
:sed -i 's/ext4/auto/g' /etc/fstab
- Disable the swap file:
sed /i 's|^/swap|#&|g' /etc/fstab
- Create new initrd:
update-initramfs -c -k all
- Reboot to validate everything is still working
- Boot from Live USB again
- Unlock the encrypted LVM device
- Convert the partition to BTRFS:
btrfs-convert --uuid copy /dev/mapper/ubuntu--vg-ubuntu--lv
- Enjoy your new Ubuntu 24.04 with BTRFS
Setup BTRFS subvolumes
- Boot from Live USB
- Mount your BTRFS volume:
mount -o subvol=/ /dev/mapper/ubuntu--vg-ubuntu--lv /mnt
- Move default subvolume to
@
cd /mnt btrfs subvolume snapshot . @ rmdir @/ext2_saved ls | grep -Ev "@|ext2_saved" | xargs rm -rf btrfs subvolume set-default @
- Create additional subvolumes
btrfs subvolume create @home cp -ax --reflink=always @/home/* @home
- Add to
/etc/fstab
:/dev/mapper/ubuntu--vg-ubuntu--lv /home btrfs defaults,subvol=@home 0 2
- Remove original files after successful migration
- Repeat for additional subvolumes. Some suggestions:
@home
@snapshots
@swap
@tmp
@var_tmp
@var_snap_lxd
@var_lib_docker
Setup swap file
btrfs filesystem mkswapfile --size 8g --uuid clear /swap/swapfile
- Add to
/etc/fstab
:/swap/swapfile none swap defaults 0 0
- Activate with
swapon -a
- Delete old swap file:
rm /swap.img