Merge branch 'refactoring'

pull/30/head
Axel Burri 2015-04-29 00:37:22 +02:00
commit 01a25ad4df
5 changed files with 827 additions and 634 deletions

View File

@ -1,12 +1,24 @@
btrbk-current
* Bugfix: allow "0" as subvolume name (closes: #10)
* New versioning scheme using more common three-level versions.
* Code refactoring: cleanup of data structures and handling of btrfs
subvolume tree, as well as security related code parts.
* Correct handling of symlinks to btrfs subvolumes (closes: #12).
* Added configuration option "snapshot_name" (closes: #5).
* Log messages now go to stderr, only the summary is printed on
stdout.
* Bugfix: allow "0" as subvolume name (closes: #10).
* Bugfix: allow "/" as volume name (closes: #15).
* Bugfix: check source AND targets for determining snapshot postfix
(closes: #11)
(closes: #11).
* Bugfix: fixed "diff" action (colses: #14).
* Allow '+' character for subvolume names.
* Filesystems on remote hosts are now printed as
"{my.remote-host.com}" in summary and logs.
btrbk-0.16
* Bugfix: correctly check retention policy for missing backups
* Bugfix: correctly check retention policy for missing backups.
btrbk-0.15

1294
btrbk

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,20 @@
#
# Example btrbk configuration file
#
# Note that the options can be overridden in the
# volume/subvolume/target sections. Refer to man btrbk.conf(5) for a
# more detailed explanation of this.
#
# Please refer to the btrbk.conf(5) man-page for more details.
#
# Note that the options can be overridden in the
# volume/subvolume/target sections.
#
# Directory in which the btrfs snapshots are created. Relative to
# <volume-directory> of the volume section.
# If not set, the snapshots are directly created in:
# <volume>/<volume-directory>
# If not set, the snapshots are created in <volume-directory>.
#
# If you want to set a custom name for the snapshot (and backups),
# use the "snapshot_name" option within the subvolume section.
#
# NOTE: btrbk does not autmatically create this directory, and the
# snapshot creation will fail if it is not present.
@ -17,10 +22,10 @@
snapshot_dir _btrbk_snap
# Perform incremental backups (set to "strict" if you want to prevent
# creation of initial backups if no parent is found)
# creation of initial backups if no parent is found).
incremental yes
# Always create snapshots, even if the target volume is unreachable
# Always create snapshots, even if the target volume is unreachable.
snapshot_create_always yes
# Resume missing backups if the target volume is reachable again.
@ -54,23 +59,22 @@ btrfs_commit_delete after
#
# Volume section: "volume <volume-directory>"
#
# <volume-directory> Directory of a btrfs volume (or subvolume)
# containing the subvolume to be backuped
# (usually the mount-point of a btrfs filesystem
# mounted with subvolid=0 option)
#
# Subvolume section: "subvolume <subvolume-name>
#
# <subvolume-name> Subvolume to be backuped, relative to
# <volume-directory> in volume section
# <volume-directory> in volume section.
#
# Target section: "target <type> <volume-directory>"
# <type> Backup type, currently only "send-receive"
# <volume-directory> Directory of a btrfs volume (or subvolume)
# receiving the backups
#
# <type> Backup type, currently only "send-receive".
# <volume-directory> Directory of a btrfs volume (or subvolume)
# receiving the backups.
#
# NOTE: The parser does not care about indentation, this is only for
# human readability. The options always apply to the last section
@ -83,7 +87,6 @@ volume /mnt/btr_system
subvolume root_gentoo
target send-receive /mnt/btr_ext/_btrbk
target send-receive /mnt/btr_backup/_btrbk
receive_log sidecar
subvolume kvm
# use different preserve matrix for kvm backups
@ -106,14 +109,9 @@ volume /mnt/btr_ext
subvolume data
target send-receive /mnt/btr_backup/_btrbk
volume /mnt/btr_boot
incremental yes
subvolume boot
target send-receive /mnt/btr_ext/_btrbk
target send-receive /mnt/btr_backup/_btrbk
volume ssh://my-remote-host.com/mnt/btr_pool
subvolume system
subvolume data_0
snapshot_dir snapshots/btrbk
snapshot_name data_main
target send-receive /mnt/btr_backup/_btrbk/my-remote-host.com

View File

@ -13,15 +13,16 @@ generated. The retention policy as well as other options can be
defined for each backup.
.PP
The options specified always apply to the last section encountered,
overriding the same option of the next higher section. This means that
superseding the values set in upper-level sections. This means that
global options must be set before any sections are defined.
.PP
The sections are:
.TP
\fBvolume\fR <volume-directory>|<url>
Directory of a btrfs volume (or subvolume) containing the source
subvolume(s) to be backuped (usually the mount-point of a btrfs
filesystem mounted with the \fIsubvolid=0\fR option).
Directory of a btrfs volume containing the source subvolume(s) to be
backuped. \fI<volume-directory>\fR must be an absolute path and point
to a btrfs volume (or subvolume). Usually the mount point of a btrfs
filesystem mounted with the \fIsubvolid=0\fR option.
.TP
\fBsubvolume\fR <subvolume-name>
Subvolume to be backuped, relative to the \fI<volume-directory>\fR
@ -29,8 +30,9 @@ specified in the \fIvolume\fR section.
.TP
\fBtarget\fR <type> <volume-directory>|<url>
Target type and directory where the backup subvolumes are to be
created. In the current version of btrbk, the only valid \fI<type>\fR
is \(lqsend\-receive\(rq.
created. \fI<volume-directory>\fR must be an absolute path and point
to a btrfs volume (or subvolume). Currently the the only valid
\fI<type>\fR is \(lqsend\-receive\(rq.
.PP
For the \fIvolume\fR and \fItarget\fR sections, you can also specify a
ssh-url instead of a local directory. The syntax for \fI<url>\fR is:
@ -38,20 +40,21 @@ ssh-url instead of a local directory. The syntax for \fI<url>\fR is:
ssh://host.xz/path/to/volume
.PP
Note that btrfs is very picky on file names (mainly for security
reasons), only the characters [0-9] [a-z] [A-Z] and "._-@" are
reasons), only the characters [0-9] [a-z] [A-Z] and "._+-@" are
allowed.
.PP
The configuration options are:
.TP
\fBsnapshot_dir\fR <directory>
Directory in which the btrfs snapshots are created. Relative to
Directory in which the btrfs snapshots are created, relative to
\fI<volume-directory>\fR of the \fIvolume\fR section. Note that btrbk
does not autmatically create this directory, and the snapshot creation
will fail if it is not present.
.TP
\fBincremental\fR yes|no|strict
Perform incremental backups. Defaults to \(lqyes\(rq. If set to
\(lqstrict\(rq, non-incremental (initial) backups are never created.
\fBsnapshot_name\fR <basename>
Base name of the created snapshot (and backup). Defaults to
\fI<subvolume-name>\fR. This option is only valid in the \fItarget\fR
section.
.TP
\fBsnapshot_create_always\fR yes|no
If set, the snapshots are always created, even if the backup subvolume
@ -62,6 +65,10 @@ is reachable again. Useful for laptop filesystems in order to make
sure the snapshots are created even if you are on the road. Defaults
to \(lqno\(rq.
.TP
\fBincremental\fR yes|no|strict
Perform incremental backups. Defaults to \(lqyes\(rq. If set to
\(lqstrict\(rq, non-incremental (initial) backups are never created.
.TP
\fBresume_missing\fR yes|no
If set, the backups in the target directory are compared to the source
snapshots, and missing backups are created if needed (complying to the

View File

@ -40,8 +40,6 @@ case "$SSH_ORIGINAL_COMMAND" in
/sbin/btrfs\ receive\ *) run_cmd ;; # mandatory if this host is backup target
/sbin/btrfs\ subvolume\ delete\ *) run_cmd ;; # mandatory if scheduling is active
/sbin/btrfs\ subvolume\ find-new\ *) run_cmd ;; # needed for "btrbk diff"
/sbin/btrfs\ filesystem\ show\ *) run_cmd ;; # needed for "btrbk info"
/sbin/btrfs\ filesystem\ df\ *) run_cmd ;; # needed for "btrbk info"
/sbin/btrfs\ filesystem\ usage\ *) run_cmd ;; # needed for "btrbk info"
*) reject_and_die ;;
esac