Updated November 2026 · Arch Linux · Btrfs · Snapper · about 12 minutes
At a glance
Btrfs can take a snapshot of your system in a moment, and take almost no space doing it. Combined with Snapper, you get a restore point before and after every software update, so a bad update becomes something you undo instead of something you rebuild from.
The short version: split the disk into separate subvolumes so a rollback restores the system without touching your files, let Snapper and the snap-pac package snapshot around every pacman change, and roll back by swapping the root subvolume for a snapshot. This page follows the layout used in our Arch Btrfs runbook, which also covers encryption and hibernation.
1. The subvolume layout
A snapshot captures one subvolume. If everything lives in a single subvolume, rolling back the system also rolls back your documents, your logs and your downloads. Separate subvolumes avoid that.
| Subvolume | Mounted at | Why it is separate |
|---|---|---|
@ | / | The system itself. This is what a rollback replaces. |
@home | /home | Your files stay as they are when the system is rolled back. |
@snapshots | /.snapshots | Where Snapper keeps its snapshots. |
@log | /var/log | Logs survive a rollback, so you can still see what went wrong. |
@pkg | /var/cache/pacman/pkg | Downloaded packages are kept out of snapshots, which saves space. |
@swap | /swap | A swap file must not be copy-on-write, so it gets its own subvolume (needed for hibernation). |
2. Create and mount it
This is done while installing, from the live installer, with the Btrfs filesystem already created and mounted. The example uses an encrypted volume called cryptroot. Substitute your own device names.
for sub in @ @home @log @pkg @snapshots @swap; do
btrfs subvolume create /mnt/$sub
done
umount /mnt
Now mount each subvolume where it belongs. The options turn on light compression and skip access-time writes.
BTRFS_OPTS="noatime,compress=zstd:1,space_cache=v2"
mount -o subvol=@,$BTRFS_OPTS /dev/mapper/cryptroot /mnt
mkdir -p /mnt/{home,.snapshots,var/log,var/cache/pacman/pkg,swap,efi}
mount -o subvol=@home,$BTRFS_OPTS /dev/mapper/cryptroot /mnt/home
mount -o subvol=@snapshots,$BTRFS_OPTS /dev/mapper/cryptroot /mnt/.snapshots
mount -o subvol=@log,$BTRFS_OPTS /dev/mapper/cryptroot /mnt/var/log
mount -o subvol=@pkg,$BTRFS_OPTS /dev/mapper/cryptroot /mnt/var/cache/pacman/pkg
mount -o subvol=@swap,noatime,nodatacow /dev/mapper/cryptroot /mnt/swap
Include the Btrfs tools, Snapper and its pacman hook in the base install:
pacstrap -K /mnt base linux linux-firmware btrfs-progs snapper snap-pac
3. Set up Snapper
Snapper wants to create its own .snapshots subvolume, which would clash with the @snapshots one we already made. Run these inside the new system (arch-chroot) to let Snapper write its configuration, then put our subvolume back in place:
umount /.snapshots
rm -rf /.snapshots
snapper --no-dbus -c root create-config /
btrfs subvolume delete /.snapshots
mkdir /.snapshots
mount -a
chmod 750 /.snapshots
Once the system is running, switch on Snapper’s timers so old snapshots are tidied up automatically:
sudo systemctl enable --now snapper-timeline.timer snapper-cleanup.timer
Already running Btrfs? You can add Snapper to an existing install in the same way, but check your subvolume names first with sudo btrfs subvolume list /. Layouts that differ from the one above need different steps.
4. Automatic snapshots
With snap-pac installed, every pacman install, upgrade or removal is wrapped in a pair of snapshots, one before and one after. Nothing more to do.
-
See what exists
List the snapshots, with their numbers and descriptions.
-
Take one yourself before something risky
Give it a clear description so you can find it again.
-
See what an update changed
Compare two snapshots by number to list the files that differ.
sudo snapper -c root list
sudo snapper -c root create --description "before kernel experiment"
sudo snapper -c root status 12..13
To undo a change to specific files without rolling back the whole system, restore them from an earlier snapshot:
sudo snapper -c root undochange 12..13 /etc/pacman.conf
Keep an eye on space. Snapshots are small at first but grow as files change. Check with sudo btrfs filesystem usage / now and then, and lower the limits in /etc/snapper/configs/root if you need to.
5. Booting an old snapshot
How you reach an old snapshot depends on the boot loader.
- GRUB: the
grub-btrfspackage adds a snapshot submenu to the boot menu, so you can start the computer from an earlier snapshot without any other tools. - systemd-boot with unified kernel images (the runbook’s setup): there is no automatic snapshot menu. If an update leaves the system unable to start, boot the fallback image, or use the installer USB, and roll back from there as in section 6.
6. Rolling back
On this layout, rolling back means replacing the @ subvolume with a copy of a snapshot. Your files in @home, your logs and the package cache are not touched. Do it from the installer USB, so the system you are replacing is not running.
Practise first. Try this once in a virtual machine or on a test machine before you ever need it. Keep your recovery key and passphrase to hand, because you must unlock the disk from the installer.
- Boot the installer USB and unlock the disk (use your passphrase or recovery key):
cryptsetup open /dev/nvme0n1p2 cryptroot
mount -o subvolid=5 /dev/mapper/cryptroot /mnt
ls /mnt/@snapshots
- Choose the snapshot by its number. Each one is in a folder with a
snapshotdirectory inside. Check the description withsnapperfirst if you are not sure which number you need. - Swap it in. The old system is kept, renamed, until you are happy:
mv /mnt/@ /mnt/@.broken
btrfs subvolume snapshot /mnt/@snapshots/12/snapshot /mnt/@
umount /mnt
reboot
- Rebuild the boot images. The kernel and boot images on the EFI partition are outside Btrfs, so they were not rolled back. Rebuild them so they match the restored system, and check they are signed:
sudo mkinitcpio -P
sudo sbctl verify
- Clean up once everything works. Mount the top level again and delete
@.brokenwithbtrfs subvolume delete.
Hibernation: keep the swap file in @swap, never inside @. That way its position on disk never changes across a rollback and hibernation keeps working.
7. If it goes wrong
| Symptom | Likely cause | What to do |
|---|---|---|
| Boots, but modules or drivers are missing after a rollback | The boot image on the EFI partition is newer than the restored system. | Rebuild with mkinitcpio -P and check signing with sbctl verify. |
| Hibernation fails after a rollback | The swap file was recreated, so its recorded position is out of date. | Keep the swap file in @swap. If it was recreated, update resume_offset in /etc/kernel/cmdline and rebuild. |
| Snapper reports an error when listing | /.snapshots is not mounted, or the permissions are wrong. | Run mount -a, then chmod 750 /.snapshots. |
| The disk keeps filling up | Old snapshots are not being cleaned up. | Check that snapper-cleanup.timer is running, and lower the limits in the Snapper config. |
| Cannot start the system at all | A failed update left the root unbootable. | Boot the fallback image or installer USB and roll back as in section 6. |
Go further: the full PDF runbook
This page covers snapshots and rollback. For a complete build that adds an encrypted disk, a signed boot chain and hibernation, use the printable runbook.
- Arch + Btrfs + Hibernation (5 pages)
Adds Snapper snapshots and an encrypted swap file for hibernation, on top of TPM unlocking and Secure Boot.