LinuxCommandLibrary

snapper

Manage filesystem snapshots with rollback capability

TLDR

List snapshot configs

$ snapper list-configs
copy

Create snapper config
$ snapper [[-c|--config]] [config] create-config [path/to/directory]
copy

Create a snapshot with a description
$ snapper [[-c|--config]] [config] create [[-d|--description]] "[snapshot_description]"
copy

List snapshots for a config
$ snapper [[-c|--config]] [config] list
copy

Delete a snapshot
$ snapper [[-c|--config]] [config] delete [snapshot_number]
copy

Delete a range of snapshots
$ snapper [[-c|--config]] [config] delete [snapshot1]-[snapshot2]
copy

SYNOPSIS

snapper [global options] command [command options]

PARAMETERS

create
    Creates a new snapshot. Options allow you to specify a description, snapshot type (pre/post), and source snapshot (for diff snapshots).

delete SNAPSHOT...
    Deletes one or more snapshots by their number.

list
    Lists available snapshots. Options allow filtering by subvolume and showing detailed information.

status SNAPSHOT...
    Displays status information for one or more snapshots.

diff SNAPSHOT1... SNAPSHOT2...
    Displays the differences between two snapshots. This is a key feature for understanding changes between system states.

rollback SNAPSHOT
    Rolls back the file system to the state of the specified snapshot. This is a destructive operation, so use with caution.

cleanup {timeline|number}
    Deletes old snapshots automatically based on defined policies (timeline, number of snapshots kept). Useful for automatic maintenance.

configs
    Lists available configurations for snapper.

get-config
    Displays current config.

set-config
    Sets configuration options for snapper.

-c CONFIG_NAME
    Specifies a configuration (defaults to 'root').

-v
    Verbose output.

-h, --help
    Show help message and exit.

DESCRIPTION

Snapper is a powerful command-line tool and YaST module for managing snapshots on Linux systems, particularly those using Btrfs or thin-provisioned LVM volumes.

It allows you to create, compare, and restore snapshots of your file system, enabling you to easily revert to previous states in case of system errors, accidental file deletion, or unwanted software installations. Snapper excels at tracking changes, automatically creating snapshots before and after system updates (using package managers like zypper, yum or apt) or when changes occur to specified directories. This allows you to easily review file differences between snapshots and rollback or restore particular file(s) when needed. Its primary use case is for system recovery and configuration management on Linux distributions that support Btrfs or LVM.

CAVEATS

Rollback operations are destructive and should be performed with extreme care. Ensure backups are available before performing a rollback. Requires root privileges to run many commands.

CONFIGURATION FILES

Snapper reads its configuration from files typically located in /etc/snapper/configs/. Each configuration file defines how Snapper operates on a specific subvolume or LVM volume.

These files specify important parameters like the target filesystem, snapshot naming conventions, and cleanup policies.

INTEGRATION WITH PACKAGE MANAGERS

Snapper's integration with package managers such as zypper on openSUSE and SLES allows for automatic snapshot creation before and after software installations and updates.

This provides a safety net, enabling you to easily revert to a previous system state if an update introduces problems.

HISTORY

Snapper was developed primarily for use with the SUSE Linux Enterprise and openSUSE distributions to provide a robust snapshotting and rollback mechanism.

Its tight integration with YaST and package managers like zypper has made it a popular choice for managing system changes. It's an actively maintained project, with ongoing improvements to functionality and performance.

SEE ALSO

btrfs(8), lvm(8)

Copied to clipboard