Snapper is not restricted to creating and managing snapshots automatically
by configuration; you can also create snapshot pairs (
after) or single snapshots manually using either the command-line
tool or the YaST module.
All Snapper operations are carried out for an existing configuration (see Section 7.4, Creating and Modifying Snapper Configurations for details). You can only take snapshots of partitions or volumes for which a configuration exists. By default the system configuration (root) is used. If you want to create or manage snapshots for your own configuration you need to explicitly choose it. Use the drop-down box in YaST or specify the -c on the command line (snapper -c MYCONFIG COMMAND).
Each snapshot consists of the snapshot itself and some metadata. When creating a snapshot you also need to specify the metadata. Modifying a snapshot means changing its metadata—you cannot modify its content. Use snapper list to show existing snapshots and their metadata:
Lists snapshots for the configuration home. To list snapshots for the default configuration (root), use snapper -c root list or snapper list.
Lists snapshots for all existing configurations.
Lists all pre and post snapshot pairs for the default (root) configuration.
Lists all snapshots of the type single for the default (root) configuration.
The following metadata is available for each snapshot:
Type: Snapshot type, see Snapshot Types for details. This data cannot be changed.
Number: Unique number of the snapshot. This data cannot be changed.
Pre Number: Specifies the number of the corresponding pre snapshot. For snapshots of type post only. This data cannot be changed.
Description: A description of the snapshot.
Userdata: An extended description where you can specify custom data in the form of a comma-separated key=value list: reason=testing, project=foo. This field is also used to mark a snapshot as important (important=yes) and to list the user that created the snapshot (user=tux).
Cleanup-Algorithm: Cleanup-algorithm for the snapshot, see Section 7.6, Automatic Snapshot Clean-Up for details.
Snapper knows three different types of snapshots: pre, post, and single. Physically they do not differ, but Snapper handles them differently.
Snapshot of a file system before a modification. Each pre snapshot has got a corresponding post snapshot. Used for the automatic YaST/Zypper snapshots, for example.
Snapshot of a file system after a modification. Each post snapshot has got a corresponding pre snapshot. Used for the automatic YaST/Zypper snapshots, for example.
Stand-alone snapshot. Used for the automatic hourly snapshots, for example. This is the default type when creating snapshots.
Snapper provides three algorithms to clean up old snapshots. The algorithms are executed in a daily cron job. It is possible to define the number of different types of snapshots to keep in the Snapper configuration (see Section 7.4.1, Managing Existing Configurations for details).
Deletes old snapshots when a certain snapshot count is reached.
Deletes old snapshots having passed a certain age, but keeps several hourly, daily, monthly, and yearly snapshots.
Deletes pre/post snapshot pairs with empty diffs.
Creating a snapshot is done by running snapper create or by clicking in the YaST module . The following examples explain how to create snapshots from the command line. It should be easy to adopt them when using the YaST interface.
HINT: Snapshot Description
You should always specify a meaningful description to later be able to identify its purpose. Even more information can be specified via the user data option.
Creates a stand-alone snapshot (type single) for the default (root) configuration with a description. Because no cleanup-algorithm is specified, the snapshot will never be deleted automatically.
Creates a stand-alone snapshot (type single) for a custom configuration named home with a description. Because no cleanup-algorithm is specified, the snapshot will never be deleted automatically.
Creates a stand-alone snapshot (type single) for a custom configuration named home with a description. The file will automatically be deleted when it meets the criteria specified for the timeline cleanup-algorithm in the configuration.
Creates a snapshot of the type pre and prints the
snapshot number. First command needed to create a pair of snapshots used
to save a
after state. The
snapshot is marked as important.
Creates a snapshot of the type post paired with the
pre snapshot number 30. Second
command needed to create a pair of snapshots used to save a
after state. The snapshot is
marked as important.
Automatically creates a snapshot pair before and after running COMMAND. This option is only available when using snapper on the command line.
Snapper allows you to modify the description, the cleanup algorithm, and the user data of a snapshot. All other metadata cannot be changed. The following examples explain how to modify snapshots from the command line. It should be easy to adopt them when using the YaST interface.
To modify a snapshot on the command line, you need to know its number. Use snapper list to display all snapshots and their numbers.
The YaSTmodule already lists all snapshots. Choose one from the list and click .
Modifies the metadata of snapshot 10 for the default (root) configuration. The cleanup algorithm is set to timeline.
Modifies the metadata of snapshot 120 for a custom configuration named home. A new description is set and the cleanup algorithm is unset.
To delete a snapshot with the YaSTmodule, choose a snapshot from the list and click .
To delete a snapshot with the command line tool, you need to know its number. Get it by running snapper list. To delete a snapshot, run snapper delete NUMBER.
Deleting the current default subvolume snapshot is not allowed.
When deleting snapshots with Snapper, the freed space will be claimed by a Btrfs process running in the background. Thus the visibility and the availability of free space is delayed. In case you need space freed by deleting a snapshot to be available immediately, use the option --sync with the delete command.
HINT: Deleting Snapshot Pairs
When deleting a pre snapshot, you should always delete its corresponding post snapshot (and vice versa).
Deletes snapshot 65 for the default (root) configuration.
Deletes snapshots 89 and 90 for a custom configuration named home.
Deletes snapshot 23 for the default (root) configuration and makes the freed space available immediately.
HINT: Delete Unreferenced Snapshots
Sometimes the Btrfs snapshot is present but the XML file containing the metadata for Snapper is missing. In this case the snapshot is not visible for Snapper and needs to be deleted manually:
btrfs subvolume delete /.snapshots/SNAPSHOTNUMBER/snapshot rm -rf /.snapshots/SNAPSHOTNUMBER
HINT: Old Snapshots Occupy More Disk Space
If you delete snapshots to free space on your hard disk, make sure to delete old snapshots first. The older a snapshot is, the more disk space it occupies.
Snapshots are also automatically deleted by a daily cron job. Refer to Cleanup-algorithms for details.