The way Snapper behaves is defined in a configuration file that is specific for each partition or Btrfs subvolume. These configuration files reside under /etc/snapper/configs/.
In case the root file system is big enough (approximately 12 GB), snapshots are automatically enabled for the root file system / upon installation. The corresponding default configuration is named root. It creates and manages the YaST and Zypper snapshot. See Configuration Data for a list of the default values.
NOTE: Minimum Root File System Size for Enabling Snapshots
As explained in Section 7.1, Default Setup, enabling snapshots requires additional free space in the root file system. The amount depends on the amount of packages installed and the amount of changes made to the volume that is included in snapshots. The snapshot frequency and the number of snapshots that get archived also matter.
There is a minimum root file system size that is required in order to automatically enable snapshots during the installation. This size is approximately 12 GB. This value may change in the future, depending on architecture and the size of the base system. It depends on the values for the following tags in the file /control.xml from the installation media:
It is calculated with the following formula: ROOT_BASE_SIZE * (1 + BTRFS_INCREASE_PERCENTAGE/100)
Keep in mind that this value is a minimum size. Consider using more space for the root file system. As a rule of thumb, double the size you would use when not having enabled snapshots.
You may create your own configurations for other partitions formatted with Btrfs or existing subvolumes on a Btrfs partition. In the following example we will set up a Snapper configuration for backing up the Web server data residing on a separate, Btrfs-formatted partition mounted at /srv/www.
After a configuration has been created, you can either use snapper itself or the YaST module to restore files from these snapshots. In YaST you need to select your , while you need to specify your configuration for snapper with the global switch -c (for example, snapper -c myconfig list).
To create a new Snapper configuration, run snapper create-config:
tux > sudo snapper -c www-data create-config /srv/www
Name of configuration file.
Mount point of the partition or Btrfs subvolume on which to take snapshots.
This command will create a new configuration file /etc/snapper/configs/www-data with reasonable default values (taken from /etc/snapper/config-templates/default). Refer to Section 7.4.1, Managing Existing Configurations for instructions on how to adjust these defaults.
HINT: Configuration Defaults
Default values for a new configuration are taken from /etc/snapper/config-templates/default. To use your own set of defaults, create a copy of this file in the same directory and adjust it to your needs. To use it, specify the -t option with the create-config command:
tux > sudo snapper -c www-data create-config -t MY_DEFAULTS /srv/www
The snapper offers several subcommands for managing existing configurations. You can list, show, delete and modify them:
Use the command snapper list-configs to get all existing configurations:
tux > sudo snapper list-configs Config | Subvolume -------+---------- root | / usr | /usr local | /local
Use the subcommand snapper -c CONFIG get-config to display the specified configuration. Config needs to be replaced by a configuration name shown by snapper list-configs. See Configuration Data for more information on the configuration options.
To display the default configuration run
tux > sudo snapper -c root get-config
Use the subcommand snapper -c CONFIG set-config OPTION=VALUE to modify an option in the specified configuration. Config needs to be replaced by a configuration name shown by snapper list-configs. Possible values for OPTION and VALUE are listed in Configuration Data.
Use the subcommand snapper -c CONFIG delete-config to delete a configuration. Config needs to be replaced by a configuration name shown by snapper list-configs.
Each configuration contains a list of options that can be modified from the command line. The following list provides details for each option. To change a value, run snapper -c CONFIG set-config "KEY=VALUE".
Granting permissions to use snapshots to regular users. See Using Snapper as Regular User for more information.
The default value is "".
Defines whether pre and post snapshots should be compared in the background after creation.
The default value is "yes".
Defines the clean-up algorithm for snapshots pairs with identical pre and post snapshots. See Section 7.6.3, Cleaning Up Snapshot Pairs That Do Not Differ for details.
File system type of the partition. Do not change.
The default value is "btrfs".
Defines the clean-up algorithm for installation and admin snapshots. See Section 7.6.1, Cleaning Up Numbered Snapshots for details.
Adds quota support to the clean-up algorithms. See Section 7.6.5, Adding Disk Quota Support for details.
Mount point of the partition or subvolume to snapshot. Do not change.
The default value is "/".
If Snapper is used by regular users (see Using Snapper as Regular User), the users must be able to access the .snapshot directories and to read files within them. If SYNC_ACL is set to yes, Snapper automatically makes them accessible using ACLs for users and groups from the ALLOW_USERS or ALLOW_GROUPS entries.
The default value is "no".
If set to yes, hourly snapshots are created. Valid values: yes, no.
The default value is "no".
Defines the clean-up algorithm for timeline snapshots. See Section 7.6.2, Cleaning Up Timeline Snapshots for details.
By default Snapper can only be used by root. However, there are cases in which certain groups or users need to be able to create snapshots or undo changes by reverting to a snapshot:
Web site administrators who want to take snapshots of /srv/www
Users who want to take a snapshot of their home directory
For these purposes Snapper configurations that grant permissions to users or/and groups can be created. The corresponding .snapshots directory needs to be readable and accessible by the specified users. The easiest way to achieve this is to set the SYNC_ACL option to yes.
Enabling Regular Users to Use Snapper
Note that all steps in this procedure need to be run by root.
If not existing, create a Snapper configuration for the partition or subvolume on which the user should be able to use Snapper. Refer to Section 7.4, Creating and Modifying Snapper Configurations for instructions. Example:
tux > sudo snapper --config web_data create /srv/www
The configuration file is created under /etc/snapper/configs/CONFIG, where CONFIG is the value you specified with -c/--config in the previous step (for example /etc/snapper/configs/web_data). Adjust it according to your needs; see Section 7.4.1, Managing Existing Configurations for details.
Set values for ALLOW_USERS and/or ALLOW_GROUPS to grant permissions to users and/or groups, respectively. Multiple entries need to be separated by Space. To grant permissions to the user www_admin for example, run:
tux > sudo snapper -c web_data set-config "ALLOW_USERS=www_admin" SYNC_ACL="yes"
The given Snapper configuration can now be used by the specified user(s) and/or group(s). You can test it with the list command, for example:
www_admin:~ > snapper -c web_data list