Snapper

Snapper is a tool created by openSUSE’s Arvin Schnell that helps with managing snapshots of BTRFS Filesystem subvolumes and thin-provisioned LVM volumes in Linux .

Snapper allows creating and managing file system snapshots. File system snapshots allow keeping a copy of the state of a file system at a certain point of time. The standard setup of Snapper is designed to allow rolling back system changes. However, you can also use it to create on-disk backups of user data.

When using Arch linux, actively used the pac-snap package which used snapper in the backed. When i moved to Alpine Linux started using the equivalent apk-snap.

Later around Mar'26, removed apk-snap along with snapper as i started using a vibe coded snapk script inspired by a new aport submission.

Install and configure Snapper

To install snapper in ubuntu/linux mint, use the below command. Install GUI only if gui interface is needed.

$sudo apt install snapper snapper-gui

Always be a root user or use sudo, when using Snapper. If the root partition or the disk is smaller than 16 GB, all Snapper features and automatic snapshots are disabled to prevent a full / partition.

Snapshot #0 always refers to the current system. Snapshots are by default stored in the .snapshots folder of the same btrfs snapshot. Refer to the next section titled Alternate file system layout for snapper.

Snapper has a default config called “root” for your root file system. The default template for config files is etc/snapper/config-templates/default. While creating config, if no options are specified, the above template is used.The config files are stored in /etc/snapper/configs

There are two types of snapshots as per snapper i.e single, pre-post. Snapper creates a snapshot before and after apt/yast runs, these snapshots are called pre and post respectively. The post snapshots knows which pre snapshots belong to it. By having a pre and post snapshot, we can see what changes happened to the file system while YaST/apt was running. Single snapshots have no special relationship to other snapshots.

Timeline, installation, administration Snapshots gets created as per timeline, boot and when config changes are made using tools like apt/yast.

File system layout for snapper

Archwiki suggested the following file system layout, which allows for easily restoring the subvolume @ that is mounted at root to a previous snapshot.

SubvolumeMountpoint
@/
@home/home
@snapshots/.snapshots
@var_log/var/log

This layout is intended not to be used with snapper rollback, but is intended to alleviate the inherent problems of Restoring “/” to its previous snapshot.

Snapper usage

2  | pre    | Friday 10 June 2022 11:01:11 PM   | root | 804.00 KiB | number   | apt
3  | post   | Friday 10 June 2022 11:01:34 PM   | root |   1.43 MiB | number   | apt

By using snapper status command, it is easy to see what has changed between snaphosts for eg: to see changes when YaST/apt was running, you have to pass the number of the pre and post snapshot:

# snapper status 2..3

The ‘c’ in the status string means that the content of the file has changed.The ‘+’ sign means that the file is new. and ‘-’ means that the file was deleted.

With snapper, we can also see the diff of all/some/individual file:

# snapper diff 2..3 [filename]

So, if you don’t like the change done by YaST/apt and want to revert it, call:

# snapper undochange 2..3

Always use -c config_file_name, if working on snapshots other than root

# snapper --list-configs

To list snapshots created as per config file data

#snapper -c data list

If you manually want to create a snapshot use:

# snapper -c home create --description "before the big cleanup"

To speedup the listing of snapshots, use the option –disable-used-space, which avoids disk usage calculations

If you are using the provided systemd timers, you can edit them to change the snapshot and cleanup frequency. When editing snapper-cleanup.timer, you need to change OnUnitActiveSec. To make cleanups occur every hour instead of every day, add:

[Timer]
OnUnitActiveSec=1h

Adding snapshots to the grub menu

There were packages like grub-btrfs ↗ to add snapshots automatically to the grub menu. Never managed to get them to work in a satisfactory manner. So disabled the feature after experimenting.

Sources:


© Prabu Anand K 2020-2026