aboutsummaryrefslogtreecommitdiffstats
path: root/send-backup
blob: 520cf0b70b90ec9dcc1070bdcbd24b60714a78c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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