I have two machines in different site. Two machine have FreeBSD and ZFS volume. One is master. and other one is backup.

I usually do a backup by this command that invoked by cron.

zfs send -i pool/vol@old pool/vol@new | ssh backup zfs recv pool/vol

But the snapshot is quite large. It needs over 24 hours, and sometime it lost the connection. If that was happen I need to re-send it first byte.

Is there any way to reconnect the ssh connection without brake pipe?

For example, I can imagine the command chunked_send and chunked_recv.

zfs send -i pool/vol@old pool/vol@new | chunked_send id1 ssh backup chunked_recv id1 zfs recv pool/vol

update:

One naive solution is use temporary file and rsync.

zfs send -i vol@old vol@new | split -b 1024m backup-tmp.
rsync backup-tmp.* backup:/tmp
ssh backup 'cat /tmp/backup-tmp.* | zfs recv vol'

I feel this is not smart.

  • Maybe you want to use rsync for this? – davidbaumann Feb 1 '14 at 5:10
  • Did you mean use rsync at first or use rsync to send the chunk? Using rsync for backup is one option, but it needs to scan all file lists instead of modified file only. Using rsync to send chunk, it requires temporary disk writing. – user295103 Feb 1 '14 at 5:28

Try encapsulating the TCP connection in UDP packets. The simplest way to do this is to install a OpenVPN udp network between the two servers.

UDP connection can wistand occasionnal disconnects. SSH connections over UDP VPN does not appear to disconnect. I'm not sure about your command, but i'm fairly certain it would resist disconnections if used over a OpenVPN network.

I've written a OpenVPN installation guide for Debian that may help you. It provide a tool easing OpenVPN server setup.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.