Installing Linux Mint with BTRFS

LUKS + BTRFS during installation

Posted by J├╝rgen on 22 december 2023

Install Linux Mint on a BTRFS root

Linux Mint is a very nice distribution, very user friendly. There's just 1 thing that has been bugging me for a while; Linux Mint comes with Timeshift, a tool for keeping savepoints of your system. But Timeshift only supports 2 snapshot techniques: Rsync or BTRFS.

When not running from a BTRFS filesystem, Timeshift is only left with Rsync, using Rsync to keep multiple snapshots will fill up your filesystem quite a bit, since every snapshot is a complete copy, which also takes a long time.

So using BTRFS, a filesystem with proper snapshotting support, meaning only delta's are kept between snapshots, would be a much better solution. But unfortunately, installing Linux Mint using BTRFS in combination with LUKS disk encryption (which imho is a must) isn't very straightforward.

This little howto is the result of some trial and error installations in order to have a working system with both LUKS and BTRFS.

How to do it

First you'll need a linux Mint installation medium. I've written this howto based on the 21.2 Victoria release. (NOTE: I've verified this to work on the 21.3 beta).

First Boot the installer.

When the live desktop has loaded, use the software manager to install partitionmanager. This is a very powerful partition manipulation tool.

partitionmanager

When the partitionmanager is installed, start it, remove any existing partitions (assuming a clean install here) and create the following partitions:

  • fat32 - 512MB This is the EFI partition
  • ext4 - 2GB This is the boot partition
  • LUKS + LVM-PV - This a LUKS encrypted LVM PV (Physical Volume)

efi-partition boot-partition luks-pv

Now create a Volume Group (VG) named system using the available PV, after creating the VG you'll need to apply in order to be able to create LV's.

system-vg

In that Volume Group, create two Logical Volumes (LV):

  • LV: swap
  • LV: root

swap-lv root-lv

Now apply any pending changes and close the partition manager

Now start the installer from the desktop as you normally would. Fill in everything until you get to selecting the Installation Type. There select Something else.

something-else

Create the following mount points:

  • /dev/mapper/system-root - format as btrfs, mount on /
  • ext4 partition - format as ext4, mount on /boot
  • fat32 partition - use as EFI System Partition

Select Install Now.

mount-points

When the installation completes, do not restart, bu instead choose Continue Testing. Now we'll need to make the installed system aware of the encrypted volume, since that was create outside of the installer.

Open a terminal and type the following:

sudo -i
mount /dev/mapper/system-root /mnt
mount --rbind /dev /mnt/@/dev/
mount --rbind /run /mnt/@/run/
mount --rbind /sys /mnt/@/sys/
mount --rbind /proc /mnt/@/proc/
chroot /mnt/@ /bin/bash -l
mount /boot
UUID=$(blkid -s UUID -o value /dev/<DEVICE THATS LUKS FORMATTED>)
echo "luks-${UUID} UUID=${UUID} none luks,discard,initramfs" | tee /etc/crypttab
update-initramfs -u -k all

my-output

Finally, when this suceeds, shutdown (and remove) the installation and rebooting will boot into your installed system.