Repository navigation
Expand file tree
/
Copy pathsnapper.toml
More file actions
178 lines (154 loc) · 6.63 KB
/
Copy pathsnapper.toml
File metadata and controls
178 lines (154 loc) · 6.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# btrfs-backup-ng Snapper Integration Configuration
#
# This example demonstrates backing up snapper-managed snapshots.
# With snapper integration, btrfs-backup-ng can:
# - Discover and back up existing snapper snapshots
# - Preserve snapper metadata (info.xml) in backups
# - Restore snapshots back into snapper format
# - Use incremental transfers for efficient backups
#
# Snapper must be installed and configured on the source system.
# See: https://en.opensuse.org/Portal:Snapper
# =============================================================================
# Global Settings
# =============================================================================
[global]
# Snapper volumes don't use snapshot_prefix (they use snapper's numbering)
# But other settings still apply
incremental = true
parallel_volumes = 1 # Snapper backups are usually sequential
parallel_targets = 2
# =============================================================================
# Snapper Volume Configurations
# =============================================================================
# -----------------------------------------------------------------------------
# Example 1: Root filesystem managed by snapper
# -----------------------------------------------------------------------------
# This backs up snapper snapshots from the 'root' config to a remote server.
# The backup preserves snapper's directory structure:
# /backups/root/.snapshots/{num}/snapshot + info.xml
[[volumes]]
path = "/"
source = "snapper" # Use snapper as snapshot source instead of native
[volumes.snapper]
config_name = "root" # Snapper config name
include_types = ["single", "pre", "post"] # Snapshot types to back up
min_age = "1h" # Skip snapshots less than 1 hour old
[[volumes.targets]]
path = "ssh://backup@nas.local:/backups/root"
ssh_sudo = true
compress = "zstd" # compressed over the wire, decompressed on the
# remote before btrfs receive
# -----------------------------------------------------------------------------
# Example 2: Home directory with selective backup
# -----------------------------------------------------------------------------
# Only back up 'single' snapshots (manual/timeline), skip pre/post pairs.
# Excludes snapshots with 'number' cleanup algorithm (transient snapshots).
[[volumes]]
path = "/home"
source = "snapper"
[volumes.snapper]
config_name = "home"
include_types = ["single"] # Only timeline/manual snapshots
exclude_cleanup = ["number"] # Skip transient snapshots
min_age = "30m"
[[volumes.targets]]
path = "ssh://backup@nas.local:/backups/home"
compress = "lz4" # compressed over the wire, decompressed on the
# remote before btrfs receive
# -----------------------------------------------------------------------------
# Example 3: Auto-detect snapper config
# -----------------------------------------------------------------------------
# When config_name is "auto", btrfs-backup-ng will find the snapper
# configuration that manages the specified path.
[[volumes]]
path = "/srv/data"
source = "snapper"
[volumes.snapper]
config_name = "auto" # Auto-detect snapper config for /srv/data
[[volumes.targets]]
path = "/mnt/backup/data"
# -----------------------------------------------------------------------------
# Example 4: Local backup of snapper snapshots
# -----------------------------------------------------------------------------
# Back up to a local external drive (no SSH).
[[volumes]]
path = "/"
source = "snapper"
[volumes.snapper]
config_name = "root"
include_types = ["single", "pre", "post"]
[[volumes.targets]]
path = "/mnt/external-backup/root"
# Subdirectory of the mount point -- name the mount point, not true.
require_mount = "/mnt/external-backup" # Fail if the drive is not mounted
# =============================================================================
# Snapper Configuration Reference
# =============================================================================
#
# [volumes.snapper] options:
#
# config_name - Snapper config name (from /etc/snapper/configs/)
# Use "auto" to detect from volume path
#
# include_types - List of snapshot types to include:
# - "single": Standalone snapshots (manual, timeline)
# - "pre": Pre-action snapshots (before zypper/dnf)
# - "post": Post-action snapshots (after zypper/dnf)
# Default: ["single", "pre", "post"]
#
# exclude_cleanup - List of cleanup algorithms to exclude:
# - "number": Keep last N snapshots (transient)
# - "timeline": Time-based retention
# - "empty-pre-post": Remove empty pre/post pairs
# Default: [] (include all)
#
# min_age - Minimum snapshot age before backing up
# Useful to avoid backing up incomplete pre/post pairs
# Format: "30m", "1h", "1d"
# Default: "0" (no minimum)
#
# =============================================================================
# Backup Directory Layout
# =============================================================================
#
# Snapper backups preserve the native snapper directory structure:
#
# /backups/root/.snapshots/
# ├── 559/
# │ ├── info.xml # Snapper metadata
# │ └── snapshot/ # Btrfs subvolume (read-only)
# ├── 560/
# │ ├── info.xml
# │ └── snapshot/
# └── 561/
# ├── info.xml
# └── snapshot/
#
# This allows direct restoration back into a snapper-managed volume.
#
# =============================================================================
# CLI Commands for Snapper
# =============================================================================
#
# List snapper configurations and snapshots:
# btrfs-backup-ng snapper list
# btrfs-backup-ng snapper list --config root --json
#
# Detect snapper configurations:
# btrfs-backup-ng snapper detect
#
# Backup snapshots (standalone, without config file):
# btrfs-backup-ng snapper backup root /mnt/backup/root
# btrfs-backup-ng snapper backup root ssh://user@host:/backups
#
# List backups at a location:
# btrfs-backup-ng snapper restore --list /mnt/backup/root
# btrfs-backup-ng snapper restore --list ssh://user@host:/backups/root
#
# Restore a specific backup:
# btrfs-backup-ng snapper restore /mnt/backup/root 559 root
# btrfs-backup-ng snapper restore ssh://user@host:/backups/root 560 root
#
# Generate config from snapper setup:
# btrfs-backup-ng snapper generate-config root /mnt/backup