This tutorial should help if you are having issues using Timeshift on a BTRFS system with swap enabled
- Turn off swap
sudo swapoff -a - Remove old swap
sudo rm /swapfile - Create dedicated BTRFS subvolume
sudo mount -o subvolid=5 /dev/nvme1n1p2 /mnt - Create the new
@swapsubvolumesudo btrfs subvolume create /mnt/@swap - Create a permanent directory for it and mount the new subvolume there
sudo mkdir -p /swap
sudo mount -o subvol=@swap /dev/nvme1n1p2 /swap
- Create the empty file
sudo touch /swap/swapfile - Disable Copy-on-Write (critical for BTRFS)
sudo chattr +C /swap/swapfile - Allocate the file size (e.g., 8GB)
sudo fallocate -l 8G /swap/swapfile - Lock down the file permissions for security
sudo chmod 600 /swap/swapfile - Format the file as swap space
sudo mkswap /swap/swapfile - Turn the new swapfile on
sudo swapon /swap/swapfile - Edit your filesystem table
sudo vim /etc/fstab - Delete the old swap line and add the new one
UUID=YOUR-UUID-HERE /swap btrfs subvol=@swap,defaults 0 0
/swap/swapfile none swap defaults 0 0
- Unmount the temporary top-level directory
sudo umount /mnt
If done correctly, swapon --show should show 8GB, findmnt /swap should show subvol=/@swap, sudo lsattr /swap/swapfile should show a capital C. Test Timeshift: sudo timeshift --create