Snapper

Snapper is a command-line program capable of managing filesystem snapshots. It has provisions for root and non-root users to review older versions of files and restore them. It also has the ability to create, delete, compare, and undo changes between snapshots. Snapper never modifies the content of snapshots. Thus it will create read-only snapshots (if supported by the system's kernel). Supported filesystems are btrfs and ext4 as well as snapshots of LVM 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 using the  optoin. 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.