|
192 | 192 | snapshotted. For that, use subvolumes or mount points.</para> |
193 | 193 | </refsect2> |
194 | 194 |
|
| 195 | + <refsect2 id='snapshot-number-sync'> |
| 196 | + <title>Highest Snapshot Number Synchronization with 'snbk' (Btrfs Only)</title> |
| 197 | + |
| 198 | + <para>This section is only relevant when the filesystem is Btrfs and the Snapper |
| 199 | + backup tool (snbk) is used. |
| 200 | + To avoid reusing snapshot numbers, 'snapperd' keeps the highest snapshot folder |
| 201 | + (whether it is an empty snapshot or not) in <filename>.snapshots</filename> |
| 202 | + directory, ensuring snapshot numbers remain unique at all times. |
| 203 | + However, when performing a restore using various methods, the state of the highest |
| 204 | + snapshot number may vary:</para> |
| 205 | + |
| 206 | + <itemizedlist> |
| 207 | + <listitem> |
| 208 | + <para>Synchronized: The latest backed-up snapshot is restored to |
| 209 | + <filename>.snapshots</filename> using `snbk restore` or manual Btrfs |
| 210 | + send-receive. |
| 211 | + In this case, the highest snapshot number is synchronized. |
| 212 | + 'snapperd' creates snapshots with numbers greater than the restored snapshot, |
| 213 | + preventing snapshot number collisions. |
| 214 | + </para> |
| 215 | + </listitem> |
| 216 | + <listitem> |
| 217 | + <para>Legacy: A restore is made with a previous but not the latest backed-up |
| 218 | + snapshot. |
| 219 | + In this case, the state of the highest snapshot number is not valid. |
| 220 | + 'snapperd' would create snapshots with numbers lower than the latest backed-up |
| 221 | + snapshot. |
| 222 | + This could invalidate the backed-up snapshots created later than the restored |
| 223 | + snapshot, and these invalid backed-up snapshots might be removed during the |
| 224 | + automatic Snapper backup process. |
| 225 | + </para> |
| 226 | + </listitem> |
| 227 | + <listitem> |
| 228 | + <para>Legacy: When using a virtualization platform and the system is restored |
| 229 | + from a virtual machine backup. |
| 230 | + In this case, depending on the timing of the VM backup creation, the state of |
| 231 | + the highest snapshot number might not be synchronized. |
| 232 | + Snapshot number collisions might occur when 'snapperd' creates snapshots after |
| 233 | + the VM boots up. |
| 234 | + </para> |
| 235 | + </listitem> |
| 236 | + |
| 237 | + </itemizedlist> |
| 238 | + |
| 239 | + <para>To avoid snapshot number collisions, Snapper provides a 'snapper-sync' |
| 240 | + script, which can be triggered by `snapper-sync.service`, to synchronize |
| 241 | + the highest snapshot number across the source and backup target devices. |
| 242 | + This requires a properly configured 'snbk'. If 'snbk' is not installed, the script |
| 243 | + does nothing. |
| 244 | + Please consider enabling `snapper-sync.service` if any scenario related to 'Legacy' |
| 245 | + might occur in your environment. |
| 246 | + |
| 247 | + If any custom systemd timer or service is configured, please consider adding |
| 248 | + the following directives: |
| 249 | + |
| 250 | + <programlisting> |
| 251 | +[Unit] |
| 252 | +After=snapper-sync.service |
| 253 | + </programlisting> |
| 254 | + |
| 255 | + This ensures systemd schedules the custom unit to run after the highest snapshot |
| 256 | + number synchronization.</para> |
| 257 | + |
| 258 | + </refsect2> |
| 259 | + |
195 | 260 | </refsect1> |
196 | 261 |
|
197 | 262 | <refsect1 id='global_options'> |
|
0 commit comments