The snapshot feature of the Btrfs filesystem can be used to perform system snapshots and rollbacks. Timeshift is a user-friendly graphical application that makes this process easy!
When properly configured, grub-btrfs
allows you to boot into Timeshift Btrfs snapshots directly from the GRUB menu, making system rollbacks easy and quick.
grub-btrfs
run:sudo pacman -S grub-btrfs
Once installed, every time the GRUB configuration file gets updated, GRUB boot entries for existing Timeshift Btrfs snapshots will automatically be created.
sudo grub-mkconfig -o /boot/grub/grub.cfg
grub-btrfs
can automate the GRUB update process whenever a new Timeshift Btrfs snapshot is created.
Run the following command to edit the grub-btrfs path unit:
sudo systemctl edit --full grub-btrfs.path
Replace the content with the following:
[Unit]
Description=Monitors for new snapshots
DefaultDependencies=no
Requires=run-timeshift-backup.mount
After=run-timeshift-backup.mount
BindsTo=run-timeshift-backup.mount
[Path]
PathModified=/run/timeshift/backup/timeshift-btrfs/snapshots
[Install]
WantedBy=run-timeshift-backup.mount
This step is reversible if needed, using:
sudo systemctl revert grub-btrfs.path
sudo systemctl enable --now grub-btrfs.path
sudo nano /etc/default/grub-btrfs/config
You might want to install timeshift-autosnap
, which automatically creates Timeshift snapshots before performing any package upgrades via Pacman. This ensures that you always have a restore point before changes are made to your system.
timeshift-autosnap
run:yay -S timeshift-autosnap
timeshift-autosnap
may require you to restart your device before it does work like expected.
To avoid GRUB being updated twice when a snapshot is created by timeshift-autosnap, It's recommended to modify the configuration file.
updateGrub
to false
by editing the following file:sudo nano /etc/timeshift-autosnap.conf
Change the line updateGrub=true
to updateGrub=false
.
Having a robust snapshot system can save your day in case something goes wrong during an update or system change.