Butter bei die Fische

The root partition of my desktop and my notebook are formatted with btrfs, the B-tree file system (or 'Butterfuss' for ease of pronunciation). I've chosen btrfs mainly for one of its many outstanding features (compared to ext4), namely, the possibility to take snapshots of a partition (more precisely, a subvolume), and to return to them if, for example, an update proves to be troublesome.

These snapshots can be managed either directly by the btrfs tools, or by snapper, a tool developed by openSUSE. Snapper is automatically installed when choosing btrfs as filesystem during the installation of openSUSE, and that's where I've encountered it first. I've found that it greatly simplifies snapshot management, and I much recommend it also for users of other distributions.

openSUSE

If you happen to have an existing openSUSE installation > 12.1, and if you use btrfs as default file system, snapper may be already alive:

snapper list-configs
snapper list

If the lists are populated, snapper is active and you've got nothing to do. Excellent!

Otherwise, issue

snapper create-config /

Snapper should now automatically take hourly snapshots of your root partition. It will also automagically take snapshots just before and after an update performed by either zypper or yast, so in case anything goes wrong, you could resort to the latest sane state of your system.

Archlinux

Snapper is also available for other Linux distributions, and in particular, for Archlinux. The instructions available are outdated and do not work, but the following steps should.

First of all, install snapper:

yaourt -S snapper-git

Next, create a subvolume (not a directory!) containing the snapshots with the mandatory (!) name .snapshots:

btrfs subvolume create /.snapshots

Then, configure snapper:

cp /etc/snapper/config-templates/default /etc/snapper/configs/root

vim /etc/conf.d/snapper
SNAPPER_CONFIGS="root"

vim /etc/cron.hourly/snapper
:%s/sysconfig/conf.d/g

Test the configuration by:

snapper list-configs

Do you see your config?

Try to create a snapshot:

snapper create -d "First manual snapshot." -c timeline

Look at your first snapshot:

snapper list

Now let snapper take care of the following snapshots. 😊