I wrote a simple script to dump zfs snapshots in a similar way to
what I did with ufsdump. In particular, it supports dump levels.
This is still very crude, but I''d appreciate comments. Does what
I''m doing make sense, or do I misunderstand zfs?
Thanks.
-----
#!/bin/ksh
#
# XXX - real option parsing
#
level=$1
fs=$2
snap="$fs at level-$level"
zfs destroy "$snap" >/dev/null 2>&1
zfs snapshot "$snap"
base="$fs at origin"
#
# find the newest numbered dump snapshot that exists
#
((i=level-1))
basecr=0
while ((i>=0))
do
if zfs list -H -o name -t snapshot "$fs at level-$i"
>/dev/null 2>&1
then
cr=`zfs get -Hp -o value creation "$fs at level-$i"`
if ((cr > basecr))
then
base="$fs at level-$i"
basecr=$cr
fi
fi
((i=i-1))
done
echo >&2 zfs send -R -v -i "$base" "$snap"
zfs send -R -v -i "$base" "$snap"