Installing Ubuntu26 on Btrfs for Timeshift snapthots
Timeshift is a handy application that lets you take snapshots of your system - this lets your roll back regrettable life choices. Sometimes you need to do risky or messy system changes, and sometimes you wish you could make those choices go away, entirely. Timeshift lets you do this properly by using atomic filesystem forks that are guaranteed to work. This is not the same as using rsync snapshots, which are messy and error prone, but it's beyond the scope of this guide to delve into the differences.
Timeshift, at least at the time of writing, supports filesystem snapshots on BTRFS only. Timeshift also requires that your boot and efi partitions are kept seperate from the root partition. And Ubuntu makes it extremely difficult to do this. But there is a way, though it's not as clean as I'd like in that it requires running a sketchy "community" shell script on your system, the script in question being (https://gitlab.com/bronger/btrfs-encrypt-root).
Running other people's shell scripts on my system is something I try to avoid, but in this case I'm willing to sacrifice my principles. The script itself is easy enough to understand, Canonical are absolutely refusing to provide an official solution, and the reward of filesystem-based Timeshift snapshots is just too great to ignore.
This process is confirmed working for both Ubuntu 24.04 and 26.04, and assumes you're going to do a full install onto a single disk and completely overwrite everything on it. This is also confirmed working on VMs and metal. Lets get into it.
- Boot your system from the Ubuntu install ISO.
- Proceed as you normally would, when you get to disk setup choose "manual installation".
- Delete all existing partitions on the disk you intend to install to.
- In the "Device for boot loader" menu select the target install disk, this should automatically
create a FAT32 paritition that mounts
/boot/efi. If this doesn't happen, your system is likely not set up with EFI support, check your VM/BIOS settings, then restart the install process until this works. - Create an additional EXT4 partition, 1GB in size (change size units in dropdown to GB),
select
/bootin the mounts dropdown. - Finally create your root data partition using all remaining disk space, the filesystem should
be btrfs, and selct
\from the mounts dropdown. - Disk setup is done, click
Nextand continue installing. Your should get a confirmation prompt that you're installing to three partitions,/boot/efi,/bootand/respectively. If you see anything else, the install will almost certainly fail later. - Assuming success, you'll get a prompt to reboot or
continue testing- select the latter. This drops you onto the Ubuntu installer desktop. - Open Firefox from the taskbar, go to (https://gitlab.com/bronger/btrfs-encrypt-root), select the
btrfs-encrypt-root.shscript and download it to your system. Read the script contents to see what it's doing. You did read it, right? - Open a terminal, make the script executable with
chmod +x btrfs-encrypt-root.sh. - Run the script as root with no arguments -
sudo ./btrfs-encrypt-root.sh. It will explain what it can do and which arguments it wants - in this case, it wants the device names for the three mount points from the previous install. You can get these by runninglsblk. Note the order of the arguments - root, then boot, then efi. - Run
sudo ./btrfs-encrypt-root.sh --only-subvols <root-dev> <boot-dev> <efi-dev>, substituting your values. It needs short names only, egssda1. You should instantly get a success response and that's it. - Reboot, and when you're in your new Ubuntu install, run
sudo blkidto confirm that the root partition is running btrfs. You can now install Timeshift and start creating and restoring btrfs snapshots on your root device.