ZFS Zfs send/receive fails over ssh

Julf

Member

Reaction score: 1
Messages: 33

I am trying to back up a filesystem to another server using the command
zfs send -vR zroot/backup@2021-10-17 | ssh julf@172.24.42.89 sudo zfs recv -duFRM zroot/backup

and I keep getting
Code:
warning: cannot send 'zroot/backup@2019-03-25-20:15:58': Broken pipe
warning: cannot send 'zroot/backup@2020-02-02-14:40:54': Broken pipe
warning: cannot send 'zroot/backup@2021-03-19-14:33:37': Broken pipe
warning: cannot send 'zroot/backup@2021-10-17': Broken pipe
after the estimates of amounts to send. Nothing in logs files.

Scratching my head here...
 

covacat

Aspiring Daemon

Reaction score: 310
Messages: 627

the warning implies the ssh command failed
if you type just the ssh command (RHS of the pipe) what happens ?
 

gpw928

Aspiring Daemon

Reaction score: 266
Messages: 593

It may be because the user julf on host 172.24.42.89 does not have /sbin in their PATH when executing commands via sshd (thus zfs not found).
Test it with ssh julf@172.24.42.89 /bin/echo '$PATH'.
Replacing sudo zfs recv with /usr/bin/sudo /sbin/zfs recv will circumvent the PATH issue.
If all that fails, check the sudo configuration.
 
OP
J

Julf

Member

Reaction score: 1
Messages: 33

the warning implies the ssh command failed
if you type just the ssh command (RHS of the pipe) what happens ?
Thanks, that helped debug the problem. Turns out I used an option (-R) that doesn't exist for zfs receive (it applies to zfs send).
 

roccobaroccoSC

Aspiring Daemon

Reaction score: 225
Messages: 749

This is how I do send/receive:
Bash:
time zfs send -LPRecv -I @402 zroot@419 | zfs receive -usF tank/backup/MyHostname/zroot
You could pipe that through SSH, it should not make any difference.

This will send a complete replication stream and compress it, so I don't have to pipe that through a compressor tool. -I lets you do incremental replication.
zfs receive supports significantly less switches than zfs send. I find -F handy but you have to make sure you don't overwrite any changes you need in the target. I use it only for backups, so that's fine for me. -s is used to enable interruptions with large datasets so that you can resume the copying if something goes wrong with the network.

Normally when you get "broken pipe" with zfs send/receive it means that either the send or the receive command failed for some reason, it may be due to incorrect syntax, full disk or whatever other reason. The failing command closes the pipe and then it is "broken" on the other side.
 

Terry_Kennedy

Aspiring Daemon

Reaction score: 347
Messages: 979

I am trying to back up a filesystem to another server using the command
zfs send -vR zroot/backup@2021-10-17 | ssh julf@172.24.42.89 sudo zfs recv -duFRM zroot/backup
If these systems are on an isolated, trusted LAN segment (or if this is a home environment), you will probably be able to get a substantial speedup for large datasets by avoiding SSH for anything beyond the control connection. I use a version of sysutils/bbcp (removed from the tree as the last few versions were badly broken). I get > 700Mbyte/second over a 10GbE LAN connection.

I go into this in a lot more detail (including sharing the scripts I wrote) here.
 
Top