Guide: Fedora BTRFS grub snapshots
This guide is a step by step how to set up a fresh install of Fedora with BTRFS snapshotting through Timeshift. These snapshots are set up to be bootable from grub for easy disaster recovery and roll back. Remember - snapshots are not backup! Set up proper backups for your important data.
Updated to reflect the new installation UI since Fedora 43.
Old way is still in brief below
- Delete all partitions on your drive
Install Fedora#
At Installation Method first choose Mount point assignment then click the 3 dots upper right and select Launch storage editor.
- Click the 3 dots on specific disks Free space to create new partition:
- Create EFI
- Type: EFI
- Size: 600MB
- Mount: /boot/efi
- Create boot
- Type: Ext4
- Size: 2GB
- Mount: /boot
- Create BTRFS (no name or mountpoint) on the rest of the free space.
- Click the 3 dots on top-level subvolume and choose Create Subvolume
| Name | Mountpoint |
|---|---|
| @ | / |
| @home | /home |
| @log | /var/log |
Then ckick Return to installation (and Continue if a popup).
Make sure Mount point assignment is selected at Installation Method.
Then map mount points to your devices:
| Mount | Device |
|---|---|
| / | @ |
| /boot/efi | EFI System Partition |
| /boot | ext4 (2GB) |
| /home | @home |
| /var/log | @log |
Before Fedora 43 - Partition with Custom Blivet-gui#
Same layout as above, just click free space and click + to add partitions (EFI, boot, BTRFS).
Then click the BTRFS-parition and create the subvolumes:
| Name | Mountpoint |
|---|---|
| @ | / |
| @home | /home |
| @log | /var/log |
Continue the installation and reboot when complete.
Edit the fstab: sudo vim /etc/fstab#
# edit ALL btrfs-volumes - add: defaults,noatime,discard=async
# from:
btrfs subvol=@,compress=zstd:1 0 0
# to:
btrfs subvol=@,compress=zstd:1,defaults,noatime,discard=async 0 0
Update the system + reboot after just to be sure.
sudo dnf update -y
Install grub-btrfs: git clone https://github.com/Antynea/grub-btrfs#
cd grub-btrfs
vim config
GRUB_BTRFS_SUBMENUNAME="Fedora Linux snapshots"
GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS="rd.live.overlay.overlayfs=1" # uncomment
GRUB_BTRFS_IGNORE_SPECIFIC_PATH=("@") # already correct
GRUB_BTRFS_IGNORE_PREFIX_PATH=("var/lib/docker" "@var/lib/docker" "@/var/lib/docker") # already correct
GRUB_BTRFS_GRUB_DIRNAME="/boot/grub2" # uncomment
GRUB_BTRFS_BOOT_DIRNAME="/boot" # uncomment
GRUB_BTRFS_MKCONFIG=/usr/sbin/grub2-mkconfig # uncomment
GRUB_BTRFS_SCRIPT_CHECK=grub2-script-check # uncomment
Save the file, then in the same directory: sudo make install
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
-
Reboot again.
-
Install the tools:
sudo dnf install inotify-tools timeshiftto have the service running, monitoring for filesystem changes. -
Launch timeshift GUI, step through the wizard:
- pick BTRFS snapshot type
- select location
- select a schedule (can be changed later)
- (I also include @home in my snapshots)
-
Take a snapshot!
Edit the systemd-service and make sure the ExecStart line looks like below:#
sudo systemctl edit --full grub-btrfsd
ExecStart=/usr/bin/grub-btrfsd --syslog --timeshift-auto
Save it, then start the service:
sudo systemctl enable --now grub-btrfsd
systemctl status grub-btrfsd
- Reboot and check grub for a new submenu (named above as “Fedora Linux snapshots”).
- In the future, to roll back just select a previous snapshot from the boot menu and use timeshift to restore.