@@ -39,6 +39,8 @@ opt_send_host=''
39
39
opt_recv_pool=' '
40
40
opt_send_opts=' '
41
41
opt_recv_opts=' '
42
+ opt_send_ssh_opts=' '
43
+ opt_send_mbuf_opts=' '
42
44
opt_sep=' _'
43
45
opt_setauto=' '
44
46
opt_syslog=' '
@@ -62,27 +64,30 @@ SNAPSHOTS_OLD=''
62
64
print_usage ()
63
65
{
64
66
echo " Usage: $0 [options] [-l label] <'//' | name [name...]>
65
- --default-exclude Exclude datasets if com.sun:auto-snapshot is unset.
66
- -d, --debug Print debugging messages.
67
- -e, --event=EVENT Set the com.sun:auto-snapshot-desc property to EVENT.
68
- --fast Use a faster zfs list invocation.
69
- -n, --dry-run Print actions without actually doing anything.
70
- -s, --skip-scrub Do not snapshot filesystems in scrubbing pools.
71
- -h, --help Print this usage message.
72
- -k, --keep=NUM Keep NUM recent snapshots and destroy older snapshots.
73
- -l, --label=LAB LAB is usually 'hourly', 'daily', or 'monthly'.
74
- -p, --prefix=PRE PRE is 'zfs-auto-snap' by default.
75
- -q, --quiet Suppress warnings and notices at the console.
76
- --send-full=F Send zfs full backup. Unimplemented.
77
- --send-incr=F Send zfs incremental backup. Unimplemented.
78
- --send-opts=F Option(s) passed to 'zfs send'.
79
- --recv-opts=F Option(s) passed to 'zfs receive'.
80
- --sep=CHAR Use CHAR to separate date stamps in snapshot names.
81
- -g, --syslog Write messages into the system log.
82
- -r, --recursive Snapshot named filesystem and all descendants.
83
- -v, --verbose Print info messages.
84
- --destroy-only Only destroy older snapshots, do not create new ones.
85
- name Filesystem and volume names, or '//' for all ZFS datasets.
67
+ --default-exclude Exclude datasets if com.sun:auto-snapshot is unset.
68
+ -d, --debug Print debugging messages.
69
+ -e, --event=EVENT Set the com.sun:auto-snapshot-desc property to EVENT.
70
+ --fast Use a faster zfs list invocation.
71
+ -n, --dry-run Print actions without actually doing anything.
72
+ -s, --skip-scrub Do not snapshot filesystems in scrubbing pools.
73
+ -h, --help Print this usage message.
74
+ -k, --keep=NUM Keep NUM recent snapshots and destroy older snapshots.
75
+ -l, --label=LAB LAB is usually 'hourly', 'daily', or 'monthly'.
76
+ -p, --prefix=PRE PRE is 'zfs-auto-snap' by default.
77
+ -q, --quiet Suppress warnings and notices at the console.
78
+ --send-full=F Send zfs full backup. Unimplemented.
79
+ --send-incr=F Send zfs incremental backup. Unimplemented.
80
+ --send-opts=F Option(s) passed to 'zfs send'.
81
+ --recv-opts=F Option(s) passed to 'zfs receive'.
82
+ --send-ssh-opts Option(s) passed to 'ssh'.
83
+ --send-mbuf-opts Use mbuffer (with these options) between 'zfs send'
84
+ and 'ssh <host> zfs receive'.
85
+ --sep=CHAR Use CHAR to separate date stamps in snapshot names.
86
+ -g, --syslog Write messages into the system log.
87
+ -r, --recursive Snapshot named filesystem and all descendants.
88
+ -v, --verbose Print info messages.
89
+ --destroy-only Only destroy older snapshots, do not create new ones.
90
+ name Filesystem and volume names, or '//' for all ZFS datasets.
86
91
"
87
92
}
88
93
@@ -221,9 +226,13 @@ do_send () # snapname, oldglob
221
226
local NAME=" $1 "
222
227
local GLOB=" $2 "
223
228
local RUNSEND=1
224
- local remote= " ssh $opt_send_host zfs receive $opt_recv_opts $opt_recv_pool "
229
+ local remote
225
230
local ii
226
231
232
+ [ -n " $opt_send_mbuf_opts " ] && remote=" mbuffer $opt_send_mbuf_opts |"
233
+ remote=" $remote ssh $opt_send_ssh_opts $opt_send_host "
234
+ remote=" $remote zfs receive $opt_recv_opts $opt_recv_pool "
235
+
227
236
# STEP 1: Go throug all snapshots we've created
228
237
for ii in $SNAPS_DONE
229
238
do
@@ -310,7 +319,7 @@ GETOPT=$(getopt \
310
319
--longoptions=debug,help,quiet,syslog,verbose \
311
320
--longoptions=pre-snapshot:,post-snapshot:,destroy-only \
312
321
--longoptions=send-full:,send-incr:,send-opts:,recv-opts: \
313
- --longoptions=pre-send:,post-send: \
322
+ --longoptions=send-ssh-opts:,send-mbuf-opts:, pre-send:,post-send: \
314
323
--options=dnshe:l:k:p:rs:qgv \
315
324
-- " $@ " ) \
316
325
|| exit 128
419
428
opt_recv_opts=" $2 "
420
429
shift 2
421
430
;;
431
+ (--send-ssh-opts)
432
+ opt_send_ssh_opts=" $2 "
433
+ shift 2
434
+ ;;
435
+ (--send-mbuf-opts)
436
+ opt_send_mbuf_opts=" $2 "
437
+ shift 2
438
+ ;;
422
439
(--sep)
423
440
case " $2 " in
424
441
([[:alnum:]_.:\ -])
0 commit comments