Show Table of Contents
Chapter 14. Creating and Maintaining Snapshots with Snapper
A snapshot volume is a point in time copy of a target volume that provides a way to revert a file system back to an earlier state. Snapper is a command-line tool to create and maintain snapshots for Btrfs and thinly-provisioned LVM file systems.
14.1. Creating Initial Snapper Configuration
Snapper requires discrete configuration files for each volume it operates on. You must set up the configuration files manually. By default, only the root user is allowed to perform snapper commands.
If you are using thin provisioning, monitor free space in the thin-pool. A fully consumed thin pool can result in data loss. For more information, see Thinly-Provisioned Logical Volumes (Thin Volumes) in the Red Hat Enterprise Linux 7 Logical Volume Manager Administration Guide.
Note that the Btrfs tools and file system are provided as a Technology Preview, which make them unsuitable for production systems.
Although it is possible to allow a user or group other than root to use certain Snapper commands, Red Hat recommends that you do not add elevated permissions to otherwise unprivileged users or groups. Such a configuration bypasses SELinux and could pose a security risk. Red Hat recommends that you review these capabilities with your Security Team and consider using the
Btrfs is available as a Technology Preview feature in Red Hat Enterprise Linux 7 but has been deprecated since the Red Hat Enterprise Linux 7.4 release. It will be removed in a future major release of Red Hat Enterprise Linux.
For more information, see Deprecated Functionality in the Red Hat Enterprise Linux 7.4 Release Notes.
Procedure 14.1. Creating a Snapper Configuration File
- Create or choose either:
- A thinly-provisioned logical volume with a Red Hat supported file system on top of it, or
- A Btrfs subvolume.
- Mount the file system.
- Create the configuration file that defines this volume.For LVM2:
snapper -c config_name create-config -f "lvm(fs_type)" /mount-pointFor example, to create a configuration file called lvm_config on an LVM2 subvolume with an ext4 file system, mounted at /lvm_mount, use:
snapper -c lvm_config create-config -f "lvm(ext4)" /lvm_mountFor Btrfs:
snapper -c config_name create-config -f btrfs /mount-point
Alternatively, to create a configuration file called
-c config_nameoption specifies the name of the configuration file.
create-configtells snapper to create a configuration file.
-f file_systemtells snapper what file system to use; if this is omitted snapper will attempt to detect the file system.
/mount-pointis where the subvolume or thinly-provisioned LVM2 file system is mounted.
btrfs_config, on a Btrfs subvolume that is mounted at
snapper -c btrfs_config create-config -f btrfs /btrfs_mount
The configuration files are stored in the