ZFS zfs send/receive from remote host w/netcat

I'd like to backup a host1 dataset into host2 via zfs send/receive & netcat but I can't figure out the right syntax. I want to run all the commands from host2

So far I've come up with something like:

"nc -l 9999 | zfs receive -F ssd_bkp/mail_home" && "ssh host1 zfs send -v zfs/mail_home@mail_home-20241023182500 | nc -w 1800 host2 9999"

but it doesn't work as intended.

Any ideas ?
 
You don’t need to complicate this with nc:

ssh host1 zfs send -v zfs/mail_home@mail_home-20241023182500 | zfs receive -F ssd_bkp/mail_home
 
It is difficult to get the timing right, and you will have constant problems with ports being busy.

You could use ssh with authentication but no encryption. I think it still has that mode.

Or try different cyphers, there's usually a faster one than default.
 
I usually run those commands on each end in a tmux session. this way the transfer isn't interrupted if you disconnect from one of the hosts.
First open the socket on the receiving side, then run the command on the sending side (otherwise it will abort because it can't connect to the receiving host)
 
Back
Top