This question originally focused on the issue of reversing the direction of the ssh connection on the transfer, but I came to realize that wasn't what was causing the problems I run into, so I simplified it.
# zfs send tank/dana@snap1 | ssh sys2 zfs recv newtank/dana
However, attempting this procedure with a test data-set I've created, containing a single 10M file, I run into the problem of Ubuntu Xenial's implementation of
zfs (ZFS-on-Linux) requiring root privileges (on the receiving side):
$ sudo -i # zfs send tank/dana@snap1 | ssh sys2 zfs recv newtank/dana Permission denied the ZFS utilities must be run as root. warning: cannot send 'tank/dana@snap1': Broken pipe
I tried to fix this issue by passing
-t flag, i.e. issuing
# zfs send tank/dana@snap1 | ssh -t sys2 "sudo zfs recv newtank/dana"
which fails with
Pseudo-terminal will not be allocated because stdin is not a terminal.
before asking for
sys2's credentials, after which the following messages are received:
sudo: no tty present and no askpass program specified warning: cannot send 'tank/dana@snap1': Broken pipe
Attempting to perform a test transfer using the other direction, using
# ssh -t sys2 "sudo zfs send newtank/dana2@snap1" | zfs recv tank/dana2
simply hangs after asking for
sys2's credentials. (Recall, each snapshot only contains a 10M file, so I believe it doesn't actually try to do anything, but I'm not sure why it hangs.)