Snapper is a tool created by openSUSE's Arvin Schnell that helps with managing snapshots of Btrfs subvolumes and LVM volumes. It can create and compare snapshots, revert between snapshots, and supports automatic snapshots timelines.
To create a configuration, you must first create a subvolume.
sudo btrfs subvolume create /home/focht/.wine
NOTE: This directory must not exist. You do not have to do this for /, as / is already a subvolume when you setup btrfs.
Now create the config itself:
sudo snapper -c wine create-config /home/focht/.wine
This will:
- create a config file in
/etc/snapper/configs/wine
based on the default template from/etc/snapper/config-templates
- create a subvolume
.snapshots
in the root of the subvolume (/home/focht/.wine/.snapshots
in this case) - add
root
toSNAPPER_CONFIGS
in/etc/conf.d/snapper
You might need to tweak the config to allow normal users to modify data
[/etc/snapper/configs $] ls -lsa
total 4
0 drwxr-xr-x. 1 root root 8 Dec 31 16:25 .
0 drwxr-xr-x. 1 root root 60 Dec 31 14:58 ..
4 -rw-r-----. 1 root root 820 Dec 31 16:25 wine
[/etc/snapper/configs $] sudo cat wine
# subvolume to snapshot
SUBVOLUME="/home/focht/.wine"
# filesystem type
FSTYPE="btrfs"
# users and groups allowed to work with config
ALLOW_USERS="focht"
ALLOW_GROUPS=""
# start comparing pre- and post-snapshot in background after creating
# post-snapshot
BACKGROUND_COMPARISON="yes"
# run daily number cleanup
NUMBER_CLEANUP="yes"
# limit for number cleanup
NUMBER_MIN_AGE="1800"
NUMBER_LIMIT="100"
# create hourly snapshots
TIMELINE_CREATE="no"
# cleanup hourly snapshots after some time
TIMELINE_CLEANUP="no"
# limits for timeline cleanup
TIMELINE_MIN_AGE="1800"
TIMELINE_LIMIT_HOURLY="10"
TIMELINE_LIMIT_DAILY="10"
TIMELINE_LIMIT_MONTHLY="10"
TIMELINE_LIMIT_YEARLY="10"
# cleanup empty pre-post-pairs
EMPTY_PRE_POST_CLEANUP="yes"
# limits for empty pre-post-pair cleanup
EMPTY_PRE_POST_MIN_AGE="1800"
Make an alias in shell environment to default to a specific config:
alias winesnapper='snapper -c wine'
List the current snapshots:
$ winesnapper list
Type | # | Pre # | Date | User | Cleanup | Description | Userdata
-------+---+-------+---------------------------------+-------+---------+----------------------------------------------------+---------
single | 0 | | | root | | current |
single | 1 | | Tue 31 Dec 2013 04:23:21 PM CET | focht | | 64-bit prefix created with wine-1.7.9-250-g201ae48 |
single | 2 | | Tue 31 Dec 2013 04:31:56 PM CET | focht | | 32-bit prefix created with wine-1.7.9-250-g201ae48 |
single | 3 | | Tue 31 Dec 2013 05:37:35 PM CET | focht | | 32-bit prefix with .NET Framework 3.5 SP1 |
single | 4 | | Tue 31 Dec 2013 06:17:16 PM CET | focht | | 32-bit prefix with .NET Framework 4.0 |
single | 5 | | Wed 01 Jan 2014 11:30:48 PM CET | focht | | 32-bit prefix with .NET Framework 3.0 |
Create a new snapshot:
winesnapper create
Delete a snapsnot #:
winesnapper delete <number>
Modify snapshot #5 description:
winesnapper modify -d "32-bit WINEPREFIX Wine 1.7.21" 5
IO Error
- Make sure.snapshots
in subvolume is a subvolume and owned byroot