@@ -39,6 +39,8 @@ opt_send_host=''
3939opt_recv_pool=' '
4040opt_send_opts=' '
4141opt_recv_opts=' '
42+ opt_send_ssh_opts=' '
43+ opt_send_mbuf_opts=' '
4244opt_sep=' _'
4345opt_setauto=' '
4446opt_syslog=' '
@@ -63,27 +65,30 @@ SNAPS_DONE=''
6365print_usage ()
6466{
6567 echo " Usage: $0 [options] [-l label] <'//' | name [name...]>
66- --default-exclude Exclude datasets if com.sun:auto-snapshot is unset.
67- -d, --debug Print debugging messages.
68- -e, --event=EVENT Set the com.sun:auto-snapshot-desc property to EVENT.
69- --fast Use a faster zfs list invocation.
70- -n, --dry-run Print actions without actually doing anything.
71- -s, --skip-scrub Do not snapshot filesystems in scrubbing pools.
72- -h, --help Print this usage message.
73- -k, --keep=NUM Keep NUM recent snapshots and destroy older snapshots.
74- -l, --label=LAB LAB is usually 'hourly', 'daily', or 'monthly'.
75- -p, --prefix=PRE PRE is 'zfs-auto-snap' by default.
76- -q, --quiet Suppress warnings and notices at the console.
77- --send-full=F Send zfs full backup.
78- --send-incr=F Send zfs incremental backup.
79- --send-opts=F Option(s) passed to 'zfs send'.
80- --recv-opts=F Option(s) passed to 'zfs receive'.
81- --sep=CHAR Use CHAR to separate date stamps in snapshot names.
82- -g, --syslog Write messages into the system log.
83- -r, --recursive Snapshot named filesystem and all descendants.
84- -v, --verbose Print info messages.
85- --destroy-only Only destroy older snapshots, do not create new ones.
86- name Filesystem and volume names, or '//' for all ZFS datasets.
68+ --default-exclude Exclude datasets if com.sun:auto-snapshot is unset.
69+ -d, --debug Print debugging messages.
70+ -e, --event=EVENT Set the com.sun:auto-snapshot-desc property to EVENT.
71+ --fast Use a faster zfs list invocation.
72+ -n, --dry-run Print actions without actually doing anything.
73+ -s, --skip-scrub Do not snapshot filesystems in scrubbing pools.
74+ -h, --help Print this usage message.
75+ -k, --keep=NUM Keep NUM recent snapshots and destroy older snapshots.
76+ -l, --label=LAB LAB is usually 'hourly', 'daily', or 'monthly'.
77+ -p, --prefix=PRE PRE is 'zfs-auto-snap' by default.
78+ -q, --quiet Suppress warnings and notices at the console.
79+ --send-full=F Send zfs full backup.
80+ --send-incr=F Send zfs incremental backup.
81+ --send-opts=F Option(s) passed to 'zfs send'.
82+ --recv-opts=F Option(s) passed to 'zfs receive'.
83+ --send-ssh-opts Option(s) passed to 'ssh'.
84+ --send-mbuf-opts Use mbuffer (with these options) between 'zfs send'
85+ and 'ssh <host> zfs receive'.
86+ --sep=CHAR Use CHAR to separate date stamps in snapshot names.
87+ -g, --syslog Write messages into the system log.
88+ -r, --recursive Snapshot named filesystem and all descendants.
89+ -v, --verbose Print info messages.
90+ --destroy-only Only destroy older snapshots, do not create new ones.
91+ name Filesystem and volume names, or '//' for all ZFS datasets.
8792"
8893}
8994
@@ -278,10 +283,14 @@ do_send () # snapname, oldglob
278283 local NAME=" $1 "
279284 local GLOB=" $2 "
280285 local RUNSEND=1
281- local remote= " ssh $opt_send_host zfs receive $opt_recv_opts $opt_recv_pool "
286+ local remote
282287 local ii
283288 local jj
284289
290+ [ -n " $opt_send_mbuf_opts " ] && remote=" mbuffer $opt_send_mbuf_opts |"
291+ remote=" $remote ssh $opt_send_ssh_opts $opt_send_host "
292+ remote=" $remote zfs receive $opt_recv_opts $opt_recv_pool "
293+
285294 # STEP 1: Go throug all snapshots we've created
286295 for ii in $SNAPS_DONE
287296 do
@@ -322,7 +331,7 @@ GETOPT=$(getopt \
322331 --longoptions=debug,help,quiet,syslog,verbose \
323332 --longoptions=pre-snapshot:,post-snapshot:,destroy-only \
324333 --longoptions=send-full:,send-incr:,send-opts:,recv-opts: \
325- --longoptions=pre-send:,post-send: \
334+ --longoptions=send-ssh-opts:,send-mbuf-opts:, pre-send:,post-send: \
326335 --options=dnshe:l:k:p:rs:qgv \
327336 -- " $@ " ) \
328337 || exit 128
431440 opt_recv_opts=" $2 "
432441 shift 2
433442 ;;
443+ (--send-ssh-opts)
444+ opt_send_ssh_opts=" $2 "
445+ shift 2
446+ ;;
447+ (--send-mbuf-opts)
448+ opt_send_mbuf_opts=" $2 "
449+ shift 2
450+ ;;
434451 (--sep)
435452 case " $2 " in
436453 ([[:alnum:]_.:\ -])
0 commit comments