Snapper

Snapper is a command-line program capable of managing filesystem snapshots. It can create, delete and compare snapshots and undo changes done between snapshots. Snapper never modifies the content of snapshots. Thus snapper creates read-only snapshots if supported by the kernel. Supported filesystems are btrfs and ext4 as well as snapshots of LVM logical volumes with thin-provisioning. Some filesystems might not be supported depending on the installation. Snapper was initially developed by SUSE Linux but is now in use across many Linux distributions.

Emerge
After USE flags have been set, emerge snapper:

Configuration
Configuration files for snapper are found in the directory. According to snapper's man page, each filesystem or subvolume that should be snapshotted by snapper requires a configuration file.

A create-config exists to aid in configuration file generation:

To create a configuration for the root filesystem, run:

This presumes the root filesystem has been formatted with btrfs or some other snapper compatible filesystem. The create-config command will attempt to guess the underlying filesystem type. If the filesystem type is known (in this case btrfs), then it can be specified. See the snapper man page for more information.

Rollback
Snapper has function called 'rollback' to switch the current mounted btrfs subvolume to an older subvolume. This feature requires a btrfs file system.

To work properly the rollback feature needs an entry in the fstab to mount the subvolume to the directory. For this example, presume that contains the btrfs filesystem snapper will manage. Add the following to :

When snapper is initialized, this fstab entry is not needed, because the subvolume is created at the root subvolume and from there accessible. After the first rollback to a snapshot subvolume (e.g. ), and upon a reboot into the snapshot subvolume the root subvolume will be left. In the snapshot subvolume, the directory is empty (e.g. ).

If the subvolume is not mounted, snapper will fail to create further subvolumes and give an input/output error.