Skip to content

Commit

Permalink
Add poolpath option
Browse files Browse the repository at this point in the history
  • Loading branch information
mrloop committed Aug 26, 2016
1 parent 68dd3fb commit d2ff8c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ PREREQUISITES:
if you wish to purge old snapshots, do that first.
6. zfs allow any additional permissions needed, to fix any errors produced in step 5
7. configure the TAG/PROP/REMUSER/REMHOST/REMPOOL variables in this script or in a config file
8. zfs set $PROP={ fullpath | basename | rootfs } pool/fs
8. zfs set $PROP={ poolpath | fullpath | basename | rootfs } pool/fs
for each FS or volume you wish to back up.

PROPERTY VALUES:
Given the hierarchy pool/a/b,
* with 'poolpath' (zfs recv -d), this is replicated to backupserver:backuppool/pool/a/b
* with 'fullpath' (zfs recv -d), this is replicated to backupserver:backuppool/a/b
* with 'basename' (zfs recv -e), this is replicated to backupserver:backuppool/b
This is useful for replicating a sub-level FS into the top level of the backup pool;
Expand Down
7 changes: 7 additions & 0 deletions zfs-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ do_backup() {
;;
-d) TARGET="$REMPOOL/$FS"
;;
-p) TARGET="$REMPOOL/$DATASET"
RECV_OPT="-d"
;;
rootfs) if [ "$DATASET" = "$(basename $DATASET)" ]; then
TARGET="$REMPOOL"
RECV_OPT="-d"
Expand Down Expand Up @@ -297,8 +300,12 @@ do
case $value in
# property values:
# Given the hierarchy pool/a/b,
# * poolpath: replicate to backuppool/pool/a/b
# * fullpath: replicate to backuppool/a/b
# * basename: replicate to backuppool/b
poolpath) [ $VERBOSE ] && printf "\n$dataset:\n"
do_backup $dataset -p
;;
fullpath) [ $VERBOSE ] && printf "\n$dataset:\n"
do_backup $dataset -d
;;
Expand Down

0 comments on commit d2ff8c4

Please sign in to comment.