#!/bin/sh zfs create -o encryption=on -o keyformat=passphrase -o keylocation=file:///root/zfs-test/passphrase tank/test/encrypted mkdir /tank/test/encrypted/should-be-root mkdir -p /tank/test/encrypted/own-dataset/nested/more for ver in a b c d do echo "$ver" > /tank/test/encrypted/ver echo "$ver" > /tank/test/encrypted/should-be-root/ver echo "$ver" > /tank/test/encrypted/own-dataset/ver echo "$ver" > /tank/test/encrypted/own-dataset/nested/ver echo "$ver" > /tank/test/encrypted/own-dataset/nested/more/ver zfs snapshot "tank/test/encrypted@$ver" done zfs create -o encryption=on -o keyformat=passphrase -o keylocation=file:///root/zfs-test/passphrase tank/test/encrypted-new zfs create -p tank/test/encrypted-new/own-dataset/nested/more for ver in a b c d do echo rsync -@-1 -avhx --progress --exclude=/should-be-root "/tank/test/encrypted/.zfs/snapshot/$ver/" /tank/test/encrypted-new/ rsync -@-1 -avhx --progress --exclude=/should-be-root "/tank/test/encrypted/.zfs/snapshot/$ver/" /tank/test/encrypted-new/ echo zfs snapshot -r "tank/test/encrypted-new@$ver" zfs snapshot -r "tank/test/encrypted-new@$ver" done