Arch Linux is a rolling release distribution: updates arrive fast, but they can sometimes break the system. Instead of praying that pacman -Syu goes well, let’s automate BTRFS snapshots before each update, with express restoration if something goes wrong.
This article follows the Arch Linux installation guide and the post-install guide where Timeshift was already mentioned. Here, we go further: automation and rollback testing.
Prerequisites#
- An Arch Linux system with BTRFS as the root filesystem (as in the installation article )
- The
btrfs-progspackage installed (included in the recommended pacstrap) - Timeshift installed:
pacman -S timeshift
Configuring Timeshift with BTRFS#
Timeshift supports two modes: rsync (file copy) and btrfs (native snapshots). BTRFS mode is instant and consumes almost no space initially (copy-on-write).
Launch Timeshift and select BTRFS mode:
sudo timeshift-gtkIn the setup wizard:
- Select snapshot type BTRFS
- Choose snapshot levels:
- Daily: 1 snapshot per day, keep for 7 days
- Weekly: 1 snapshot per week, keep for 4 weeks
- On boot: 1 snapshot at each boot
- Exclude large directories if needed (e.g.,
/opt/datacan be excluded if you store large files which don’t need to be restored)
Automating snapshots before updates#
Timeshift handles scheduled snapshots, but the most critical moment is right before an update. Let’s create a pacman hook to trigger a snapshot automatically.
Creating a PreTransaction pacman hook#
Pacman hooks execute at specific points in the update cycle. PreTransaction runs before pacman modifies anything.
Create /etc/pacman.d/hooks/timeshift-autosnap.hook:
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Path
Target = usr/lib/modules/*/vmlinuz
[Action]
Description = Creating Timeshift BTRFS snapshot before upgrade...
Depends = timeshift
When = PreTransaction
Exec = /usr/bin/timeshift --create --comments "auto-snapshot before pacman upgrade" --tags DThis hook only fires when a package touches the kernel (vmlinuz), covering major updates. To trigger on every update, replace the Target section with:
Type = Package
Target = *Warning: A snapshot on every transaction can fill up disk space if you install many packages. Adjust the retention policy in Timeshift accordingly.
Alternative: the timeshift-autosnap package#
An AUR package does exactly this with finer configuration:
yay -S timeshift-autosnapSource: https://aur.archlinux.org/packages/timeshift-autosnap
It installs the hook automatically and allows configuring the maximum number of snapshots in /etc/timeshift-autosnap.conf.
Restoring from a snapshot#
Case 1: the system still boots#
If your system boots but an update broke something:
# List available snapshots
sudo timeshift --list
# Restore a specific snapshot
sudo timeshift --restore --snapshot '2026-06-27-18-00-01' --target /dev/mapper/stoLocal-rootTimeshift replaces the current filesystem with the snapshot and offers to reboot. Select the date and modify the name of your virtual disk to match your disk name.
Case 2: the system won’t boot#
In the following commands, I use a typical configuration where your disk is /dev/sda and your root partition is /dev/sda2. Of course, adapt these commands to your configuration.
This is the critical scenario. If the system doesn’t boot after an update:
- Boot from the Arch Linux ISO
- Decrypt and mount your partitions (as during installation):
- List BTRFS snapshots:
- Restore with Timeshift from chroot:
- Reboot.
cryptsetup luksOpen /dev/sda2 luks
mount /dev/mapper/stoLocal-root /mnt
btrfs subvolume list /mnt
arch-chroot /mnt timeshift --restore --snapshot '2026-06-27-18-00-01'Or restore manually with BTRFS:
# Rename the broken subvolume
mv /mnt/@ /mnt/@.broken
# Promote the snapshot to active subvolume
btrfs subvolume snapshot /mnt/@.snapshots/2026-06-27-18-00-01/snapshot /mnt/@Verifying snapshots work#
Test your configuration before you need it:
# Create a manual snapshot
sudo timeshift --create --comments "test snapshot" --tags D
# List
sudo timeshift --list
# Check space used by snapshots
btrfs filesystem df /Rotation and cleanup#
BTRFS snapshots consume space as blocks diverge. Monitor disk space:
# Total space used by snapshots
btrfs filesystem usage /
# Manual cleanup of old snapshots
sudo timeshift --delete --snapshot '2026-06-20-18-00-01'Timeshift automatically manages rotation according to your retention rules, but keeping an eye on disk space is recommended.
Conclusion#
With BTRFS and Timeshift, Arch Linux rolling release becomes much safer. A pre-update snapshot takes less than a second, and restoration takes minutes — even from a system that won’t boot. Minimal investment for maximum safety net.

