Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add poolpath option #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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