solaris zfs manual replication (scripted)

#!/usr/bin/ksh
echo "source pool/fs (no leading slash) : \c "
read s
echo "destination pool/fs (no leading slash) : \c "
read d
echo "cleaning up destination."
zfs destroy -f $d 2> /dev/null; echo "done."
echo creating base snapshot
zfs snapshot $s@new ; echo done
echo baseline replication from $s to $d
zfs send $s@new | zfs receive $d@new
zfs rollback $d@new ; echo done
echo loop
while true
do
sleep 5
echo 1 rename $s new to old
zfs rename $s@new @old ;echo done
echo 2 create $s new snap
zfs snapshot $s@new ; echo done
echo 3 rename destination snapshot from new to old
zfs rename $d@new @old ; echo done
echo 4 send incremental from $s@old and $s@new
zfs send -i $s@old $s@new | zfs receive -F $d@new ; echo done
echo 5 update active $d fron $d@new
zfs rollback $d@new ; echo done
echo 6 remove $d@old
zfs destroy $d@old ; echo done
echo 7 remove $s$old
zfs destroy $s@old ; echo done
done

This entry was posted in solaris. Bookmark the permalink.

Comments are closed.