'\" t
.\" Title: snbk
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 2024-11-05
.\" Manual: Filesystem Snapshot Management
.\" Source: 0.12.0
.\" Language: English
.\"
.TH "SNBK" "8" "2024\-11\-05" "0\&.12\&.0" "Filesystem Snapshot Management"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
snbk \- Command\-line program to backup snapshots of snapper
.SH "SYNOPSIS"
.HP \w'\fBsnbk\fR\ 'u
\fBsnbk\fR [\fI\-\-global\-opts\fR] \fIcommand\fR [\fIcommand\-arguments\fR]
.HP \w'\fBsnbk\fR\ 'u
\fBsnbk\fR {\-\-help}
.SH "DESCRIPTION"
.PP
Snbk is a command\-line program to backup snapshot of snapper\&. It can transfer and delete backup snapshots on local and remote btrfs filesystems\&.
.SH "CONCEPTS"
.SS "Backup Configurations"
.PP
For each snapper config there can be several backup configs\&. Each backup config defines backups of the snapper snapshots at one location, either local or remote, see
\fBsnapper-backup-configs\fR(5)
for possible settings\&.
.SS "Snapshot Statuses"
.PP
Each snapshot has a status on the source and on the target\&. Possible values for the source are:
.PP
(empty)
.RS 4
The snapshot is missing and thus considered obsolete on the target\&. It will be deleted on the target by the next delete command\&.
.RE
.PP
read\-only
.RS 4
The snapshot is read\-only\&.
.RE
.PP
read\-write
.RS 4
The snapshot is read\-write and thus cannot be backed\-up\&.
.RE
.PP
Possible values for the target are:
.PP
(empty)
.RS 4
The snapshot is missing\&. If the source snapshot is read\-only it will be transferred to the target by the next transfer command\&.
.RE
.PP
valid
.RS 4
The snapshot is valid\&. That implies it is read\-only\&.
.RE
.PP
invalid
.RS 4
The snapshot is invalid\&. Either the received UUID is wrong or it is read\-write\&. That can happen if the transfer was interrupted\&. The next transfer command will try to transfer the snapshot again\&.
.RE
.SH "GLOBAL OPTIONS"
.PP
\fB\-q, \-\-quiet\fR
.RS 4
Suppress normal output\&. Error messages will still be printed, though\&.
.RE
.PP
\fB\-v, \-\-verbose\fR
.RS 4
Increase verbosity\&.
.RE
.PP
\fB\-\-debug\fR
.RS 4
Turn on debugging\&.
.RE
.PP
\fB\-\-utc\fR
.RS 4
Display dates and times in UTC\&. By default, local time is used\&.
.RE
.PP
\fB\-\-iso\fR
.RS 4
Display dates and times in ISO format\&. ISO format is always used for machine\-readable outputs\&.
.RE
.PP
\fB\-t, \-\-table\-style \fR\fB\fIstyle\fR\fR
.RS 4
Specifies table style\&. Table style is identified by an integer number\&.
.RE
.PP
\fB\-\-machine\-readable \fR\fB\fIformat\fR\fR
.RS 4
Specifies a machine\-readable output format\&. Possible options are csv and json\&.
.RE
.PP
\fB\-\-csvout\fR
.RS 4
Sets CSV output format\&. See
\m[blue]\fBRFC 4180\fR\m[]\&\s-2\u[1]\d\s+2
for the details, except lines end with a LF, not CR+LF\&.
.RE
.PP
\fB\-\-jsonout\fR
.RS 4
Sets JSON output format\&.
.RE
.PP
\fB\-\-separator \fR\fB\fIcharacter\fR\fR
.RS 4
Specifies the character separator for CSV output format\&.
.RE
.PP
\fB\-\-no\-headers\fR
.RS 4
Suppress headers for CSV output format\&.
.RE
.PP
\fB\-b, \-\-backup\-config \fR\fB\fIname\fR\fR
.RS 4
Use specified configuration instead of all configurations\&.
.RE
.PP
\fB\-\-no\-dbus\fR
.RS 4
Operate without a DBus connection\&.
.sp
Use with caution\&.
.RE
.PP
\fB\-\-target\-mode \fR\fB\fIname\fR\fR
.RS 4
Only operate on backup configs with the specified target mode\&.
.RE
.PP
\fB\-\-automatic\fR
.RS 4
Only operate on backup configs which have the automatic flag set\&.
.RE
.PP
\fB\-\-version\fR
.RS 4
Print version and exit\&.
.RE
.SH "COMMANDS"
.PP
Snbk provides a number of
\fIcommands\fR\&. Each command accepts the options listed in the
GLOBAL OPTIONS
section\&. These options must be specified
\fIbefore\fR
the command name\&. In addition, many commands have specific arguments, which are listed in this section\&. These command\-specific arguments must be specified
\fIafter\fR
the name of the command\&.
.PP
\fBhelp\fR
.RS 4
Show short help text\&.
.RE
.PP
\fBlist\-configs\fR
.RS 4
List available configurations\&.
.RE
.PP
\fBlist (ls)\fR
.RS 4
List snapshots\&.
.RE
.PP
\fBtransfer [\fR\fB\fInumber\fR\fR\fB]\fR
.RS 4
Transfer all missing snapshots or the specified snapshot to the target\&.
.RE
.PP
\fBdelete (remove|rm) [\fR\fB\fInumber\fR\fR\fB]\fR
.RS 4
Delete all obsolete snapshots or the specified snapshot from the target\&.
.RE
.PP
\fBtransfer\-and\-delete\fR
.RS 4
Combines transfer and delete\&.
.RE
.SH "RESTORE"
.PP
So far a restore has to be done manually\&. There are several methods to do a restore, e\&.g\&. the backup can be mounted and then copied or rsync can be used\&. Here we provide an example on how to use btrfs send and receive to restore a snapshot on the source system\&. In general using btrfs send and receive is a bit tricky\&.
.PP
When using target\-mode local:
.sp
.if n \{\
.RS 4
.\}
.nf
# mkdir /\&.snapshots/42
# cp /backups/root/42/info\&.xml /\&.snapshots/42/
# btrfs send /backups/root/42/snapshot | btrfs receive /\&.snapshots/42
.fi
.if n \{\
.RE
.\}
.sp
When using target\-mode ssh\-push:
.sp
.if n \{\
.RS 4
.\}
.nf
# mkdir /\&.snapshots/42
# scp backups\&.example\&.com:/backups/eberich/root/42/info\&.xml /\&.snapshots/42
# ssh backups\&.example\&.com btrfs send /backups/eberich/root/42/snapshot | btrfs receive /\&.snapshots/42
.fi
.if n \{\
.RE
.\}
.PP
If the system was reinstalled it is unfortunately in general not possibly to simply use the restored snapshot as the new default snapshot since some files, e\&.g\&. /etc/fstab, likely need modifications\&. Also unfortunately for other subvolumes than root a rollback is not supported\&.
.PP
If there are snapshots on the source to speed up the operation you can also use the \-p option for btrfs send\&.
.SH "NOTES"
.PP
The content of snapshots transferred must not be changed on the source system\&. Normally this is ensured since the snapshots are read\-only\&. But it is possible to change snapshots to read\-write\&. This can cause error during transfers in the future\&.
.SH "PERMISSIONS"
.PP
Since the target\-mode ssh\-push needs root permissions on the target it is recommended to use a dedicated machine or container as a target\&.
.SH "FILES"
.PP
/etc/snapper/backup\-configs
.RS 4
Directory containing configuration files\&.
.RE
.SH "EXIT STATUS"
.PP
Normally the exit status is 0\&. If an error occurred the exit status is 1\&.
.SH "HOMEPAGE"
.PP
\m[blue]\fBhttp://snapper\&.io/\fR\m[]
.SH "AUTHORS"
.PP
Arvin Schnell
.SH "SEE ALSO"
.PP
\fBsnapper-backup-configs\fR(5),
\fBsnapper\fR(8),
\fBbtrfs-send\fR(8),
\fBbtrfs-receive\fR(8)
\fBrsync\fR(1),
\fBsshfs\fR(1)
.SH "NOTES"
.IP " 1." 4
RFC 4180
.RS 4
\%https://tools.ietf.org/html/rfc4180
.RE