aboutsummaryrefslogtreecommitdiffstats
path: root/send-backup
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2017-10-11 23:36:34 -0400
committerBrian Cully <bjc@kublai.com>2017-10-12 00:01:17 -0400
commitb6e77390279ca0b5ae4953df8f651311420f6238 (patch)
tree95c91c179d3ca2b62fe5922213133cc740441d93 /send-backup
downloadzfs-scripts-b6e77390279ca0b5ae4953df8f651311420f6238.tar.gz
zfs-scripts-b6e77390279ca0b5ae4953df8f651311420f6238.zip
Initial commit.
Diffstat (limited to 'send-backup')
-rwxr-xr-xsend-backup15
1 files changed, 15 insertions, 0 deletions
diff --git a/send-backup b/send-backup
new file mode 100755
index 0000000..520cf0b
--- /dev/null
+++ b/send-backup
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+src=babar
+dst=backup
+
+datasets=`zfs list -Ho name -r $src | tail -n +2 | cut -d/ -f2-`
+for fs in $datasets; do
+ from=`zfs list -Ht snap -d 1 -o name -s creation $dst/$fs | tail -1 | cut -d@ -f2`
+ to=`zfs list -Ht snap -d 1 -o name -s creation $src/$fs | tail -1 | cut -d@ -f2`
+
+ echo send $fs@$from to $fs@$to
+ if [ "x$from" != "x$to" ]; then
+ zfs send -RI babar/$fs@$from babar/$fs@$to | zfs recv backup/$fs
+ fi
+done