snapper
Manage filesystem snapshots with rollback capability
TLDR
List snapshot configs
Create snapper config
Create a snapshot with a description
List snapshots for a config
Delete a snapshot
Delete a range of snapshots
SYNOPSIS
snapper [options] command [subcommand] [arguments]
Examples:
snapper list
snapper -c root create --description "My first snapshot"
snapper rollback
PARAMETERS
-c
Specify the configuration to use (e.g., `root` for the root filesystem).
-q, --quiet
Suppress normal output messages.
-v, --verbose
Produce more verbose output.
--no-dbus
Do not use the DBus daemon for communication. Forces direct file access (may require root).
--json
Output data in JSON format, useful for scripting.
--version
Show program's version number and exit.
--help
Show a help message and exit.
DESCRIPTION
snapper is a powerful command-line tool designed for managing filesystem snapshots, primarily on Btrfs and ZFS filesystems. It provides a user-friendly interface to create, delete, and manage snapshots, enabling features like system rollbacks, easy data recovery, and version control for your filesystem.
It supports various snapshot types, including pre- and post-snapshots, often used to capture system state before and after package manager operations (e.g., `zypper` or `dnf`). snapper can also compare snapshots to show changes, and restore files or even the entire system to a previous state. Its integration with package managers and the ability to schedule automatic snapshots make it an invaluable tool for system administrators and users seeking robust data protection and system resilience.
CAVEATS
snapper requires a Btrfs or ZFS filesystem for full functionality. While it has experimental support for EXT4 and XFS via LVM-thin, its primary design and robust features are for Btrfs and ZFS. Most operations require root privileges. Care should be taken with rollback operations as they can be destructive if not fully understood.
CONFIGURATIONS
snapper operates based on configurations, typically one per filesystem root or subvolume (e.g., `root`, `home`, `srv`). These configurations are defined in files located in `/etc/snapper/configs/` and control aspects like cleanup algorithms, snapshot frequency, and disk usage limits.
SNAPSHOT TYPES
snapper distinguishes between various snapshot types:
- single: Manually created snapshots for specific points in time.
- pre: Snapshots taken before a significant system operation (e.g., package update).
- post: Snapshots taken after a significant system operation, linked to a corresponding `pre` snapshot. This allows seeing changes made by an operation.
CLEANUP ALGORITHMS
To manage disk space, snapper includes automated cleanup algorithms defined per configuration. Common types include:
- timeline: Keeps snapshots at specific time intervals (e.g., hourly, daily, monthly).
- number: Keeps a certain fixed number of snapshots.
- empty-pre-post: Removes `pre`/`post` pairs if no changes occurred between them.
COMMON COMMANDS
Beyond the global options, snapper uses subcommands for its core functionality:
- list: Lists all existing snapshots for a given configuration.
- create: Creates a new snapshot. This is essential for manual backups or before critical system changes.
- delete: Removes one or more snapshots by their number.
- diff: Shows the differences between two snapshots or between a snapshot and the current system state.
- rollback: Rolls back the system to a specific snapshot. This is a powerful and potentially destructive operation that replaces the current filesystem state with that of the snapshot.
- undochange: Reverts specific file changes from a snapshot.
HISTORY
snapper was initially developed by openSUSE and SUSE to provide robust filesystem snapshot management, particularly leveraging Btrfs capabilities. It was introduced to offer advanced system rollback features, tightly integrated with package management tools like YaST and `zypper` (on openSUSE/SLES). Its development aimed to simplify complex snapshot operations and make system state management more accessible and reliable for users and administrators alike.