zfs send
to generate and store the data, then you could use something as rsync to get it stored onto a remote site. Maybe rsync can also utilize stdin but I'm not sure from mind. zfs receive
. So I can restore data without having to depend on having to start any specific processes on my remote backup host. zfs send ... | nc dest_host 4242
on the sending side and nc -l 4242 | zfs recv ...
on receiving. Start the receive side first since it will sit and block and wait for a connection. zfs send ... > /dev/tcp/dest_host/4242
for the send. The listen side you need something like nc
to create the listening port.Isn't that /dev/tcp trick Linux only?
That doesn't seem correct. Bash is merely a shell which mainly relies on the OS to provide features such as these, see also bash(1):No, but you do need to install bash from ports.
Bash handles several filenames specially when they are used in redirec-
tions, as described in the following table. If the operating system on
which bash is running provides these special files, bash will use them;
otherwise it will emulate them internally with the behavior described
below.
/dev/fd/fd
If fd is a valid integer, file descriptor fd is dupli-
cated.
/dev/stdin
File descriptor 0 is duplicated.
/dev/stdout
File descriptor 1 is duplicated.
/dev/stderr
File descriptor 2 is duplicated.
/dev/tcp/host/port
If host is a valid hostname or Internet address, and port
is an integer port number or service name, bash attempts
to open the corresponding TCP socket.
That doesn't seem correct. Bash is merely a shell
I did, but I got an error that the file or directory doesn't exist, as such my conclusion.Bash interprets your request for /dev/tcp/.... and opens the requested connection. Try it and see.
$ echo foo > /dev/tcp/remote-host/9999
on sending system. $ nc -l 9999
foo
on receiving system. $pkg info bash
bash-4.4.23
Name : bash
Version : 4.4.23
Installed on : Wed Jun 6 22:53:15 2018 CDT
Origin : shells/bash
Architecture : FreeBSD:11:amd64
Prefix : /usr/local
Categories : shells
Licenses : GPLv3+
Maintainer : ehaupt@FreeBSD.org
WWW : https://www.gnu.org/software/bash/
Comment : GNU Project's Bourne Again SHell
Options :
COLONBREAKSWORDS: on
DOCS : on
FDESCFS : off
HELP : on
NLS : on
STATIC : off
SYSBASHRC : off
SYSLOG : off
Shared Libs required:
libintl.so.8
Annotations :
FreeBSD_version: 1101001
cpe : cpe:2.3:a:gnu:bash:4.4.23:::::freebsd11:x64
repo_type : binary
repository : Synth
Flat size : 7.75MiB
Description :
This is GNU Bash. Bash is the GNU Project's Bourne Again SHell,
a complete implementation of the POSIX.2 shell spec, but also
with interactive command line editing, job control on architectures
that support it, csh-like features such as history substitution and
brace expansion, and a slew of other features.
WWW: https://www.gnu.org/software/bash/
$ echo foo > /dev/tcp/[I]remote[/I]/[I]port[/I]
-bash: connect: Connection refused
-bash: /dev/tcp/[I]remote[/I]/[I]port[/I]: Connection refused
And I can now indeed confirm this too Thanks!Odd; it works for me. Did you try to browse into it, or to redirect output into a /dev/tcp/<hostname>/<port> ? Only the latter will work.
# bbcp -4 c -N io "zfs send -I poolname/dataset@snapname1 poolname/dataset@snapname2" remoteuser@remoteserver:"zfs recv -d poolname"
zfs send
through the bbcp transport, and pipe it out to the zfs recv
on the other end.Not as far as i can tell. But bbcp can be used in a similar fashion as rsync. It has the same incremental file transfer capabilities, although I've never looked into it to deeply. It's one of the reasons it was made, though.Can I do rsync over bbcp?
It's a bit like Netcat, but it doesn't require ssh authentication.sysutils/bbcp works for this. It uses SSH to authenticate the connection, but transfers the data in the clear, using multiple streams.