1 .TH "mbuffer" "1" "@PACKAGE_VERSION@" "Thomas Maier-Komor" "console utility"
3 mbuffer \- measuring buffer
6 mbuffer [\fIoptions\fP]
9 mbuffer buffers I/O operations and displays the throughput rate. It is
10 multi-threaded, supports network connections, and offers more options
11 than the standard buffer.
15 \fB\-i\fR <\fIfilename\fP>
16 Use \fIfilename\fP as input instead of the standard input (needs to be
17 given for multi volume support). If \fIfilename\fP is \-, input is read
20 \fB\-I\fR <\fIport\fP>
21 Use network port \fIport\fP as input instead of the standard input. If
22 given a hostname and a port in the form hostname:port, the first interface
23 with the IP of hostname will be used.
25 \fB\-o\fR <\fIfilename\fP>
26 Use \fIfilename\fP as output instead of the standard output (needs to be
27 given for multi volume support, will enable use of sendfile if
28 available). If \fIfilename\fP is \-, output is written to standard
29 output. The option \-o can be passed multiple times to specify multiple
32 \fB\-O\fR <\fIhostname:port\fP>
33 Write output to \fIhostname:port\fP instead of the standard output (will
34 enable use of sendfile if available). This option can be used multiple
35 times to send data to multiple machines.
38 Use \fInum\fP blocks for buffer (default 256).
40 \fB\-s\fR <\fIsize\fP>
41 Use blocks of \fIsize\fP bytes for buffer (default pagesize of system).
43 \fB\-m\fR <\fIsize\fP>
44 Use a total of \fIsize\fP bytes for buffer (default 2MB) \- size can be
45 set with a trailing character (b and B for Byte, k for kByte, M for
46 MByte, G for Gigabyte, and with % for a percentage of total physical
50 Lock buffer in memory \- this option is not available for file-based
51 buffers and requires mbuffer to be set-UID root (use with care).
54 \fInum\fP volumes in input device (requires use of option \-i for input
55 device specification, pass 0 as argument if mbuffer should prompt for every
59 use a memory-mapped temporary file as buffer (use with huge buffers)
61 \fB\-T\fR <\fIfile\fP>
62 as \-t but use \fIfile\fP instead
65 use block-size of device for output (needed for some devices, slows output down)
67 \fB\-D\fR <\fIsize\fP>
68 assume an output volume of \fIsize\fP bytes (default infinite) after which
69 a volume change will be initiated. Small values are useful for the timely
70 testing of multi-volume runs; accurate values if your device doesn't properly
71 signal end of media. Size can be set with a trailing character (b and B
72 for Byte, k for kByte, M for MByte, or G for Gigabyte)
75 start writing after the buffer has been filled to \fInum\fP% (default 0 \- start at once)
78 start reading after the buffer has dropped below fill-ratio of \fInum\fP% (default 100 \- start at once)
80 \fB\-l\fR <\fIfile\fP>
81 log messages to \fIfile\fP instead of standard error output
84 pause \fInum\fP microseconds after each write \- might increase performance on some drives with very low performance (< 1 MB/sec)
86 \fB\-r\fR <\fIrate\fP>
87 Set the maximum read rate to <\fIrate\fP>. <\fIrate\fP> can be given in
88 either Bytes, kBytes, MBytes, or GBytes per second. To do so, use an appropriate
89 suffix (i.e. k,M,G). This option is useful if you have a tape that is
90 capable of transferring data faster than the host can handle it. In this
91 case you can use this option to limit the transfer rate and keep the
92 tape running. Be aware that this is both good for your tape drive, and
93 enhances overall performance, by avoiding tape screwing.
95 \fB\-R\fR <\fIrate\fP>
96 Same as above only for setting the transfer limit for the writer.
99 the device used is an autoloader which uses \fIcmd\fP to load the next
100 volume. Pass <\fI/bin/false\fP> as an autoload command to suppress the
101 warning message that appears when run without controlling terminal (e.g.
102 via cron). Like this the autoload will fail and mbuffer will terminate
103 with an error message when reaching the end of the tape.
105 \fB\-a\fR <\fItime\fP>
106 the device used is an autoloader which takes \fItime\fP seconds to load a new tape
109 overwrite output file if it exists already
112 write with synchronous data integrity support \- This option forces all
113 writes to complete before continuing. This enables errors to be reported
114 earlier and more precisely, but might decrease performance. Especially
115 systems with high level of data integrity support suffer a huge
116 performance hit. Others might seem to be unaffected, but just neglect
117 support for full synchronous data integrity.
119 \fB\-v\fR <\fInum\fP>
120 set verbose level to \fInum\fP. Valid values are 0..6 (0 = none, 1 =
121 errors, 2 = warnings, 4 = information messages, 5 = debugging messages, 6 =
122 I/O debugging). Higher values include lower values messages.
125 quiet \- do not display the status on the standard error output
128 quiet \- do not log the status in the log file
131 Use O_DIRECT to open file descriptors. This option is not available on
132 all systems. It tells the OS to bypass the page cache to improve
133 performance when reading and writing. On Solaris this is an auto-magic
134 option that is enabled if it is supported for the relevant file. Be
135 aware that this option might lead to read/write failures, if the buffer
136 isn't properly aligned for direct I/O. Additionally, open might fail
137 with EINVAL (i.e. invalid argument) if the named file does not support
141 Open next output file given via option \-o in append mode.
144 Truncate next output file given via option \-o when opening it.
147 Force IPv6 mode for the following network I/O options on command line.
149 Force IPv4 mode for the following network I/O options on command line.
151 Choose IPv4/IPv6 mode on demand.
154 Output help information and exit.
157 Generate a MD5 hash of transferred data.
160 Print PID of current process. This option can help you to figure out
161 which instance of mbuffer to kill, if multiple are running and one is
162 hanging due to a network issue. Printing of the PID can also be
163 triggered by adding "printpid = 1" to your .mbuffer.rc file.
165 \fB\-V, \-\-version\fR
166 Output version information and exit.
168 \fB\-W\fR <\fItimeout\fP>
169 Activates a watchdog that gets triggered every \fItimeout\fP seconds and
170 checks weather I/O activity has stalled. If either channel has stalled
171 for a complete period, the watchdog writes an error message and
172 terminates mbuffer via SIGINT. Be aware that the watchdog is unaware of
173 tape-change activities. So choose the watchdog timeout greater that the
174 worst-case tape-change time.
176 The default values for following options can be set as \fIkey = value\fP pairs
177 in the ~/.mbuffer.rc file:
179 \fIblocksize\fP: block size (option \-s)
181 \fItimeout\fP: watchdog timeout (option \-W)
183 \fItotalmem\fP: total buffer size (option \-m)
185 \fImaxreadspeed\fP: maximum read speed (option \-r)
187 \fImaxwritespeed\fP: maximum write speed (option \-R)
189 \fIstartwrite\fP: threshold for start writing (option \-P)
191 \fIstartread\fP: threshold for start reading (option \-p)
193 \fIpause\fP: pause after writing a block (option \-u)
195 \fInumblocks\fP: number of blocks in buffer (option \-b)
197 \fImemlock\fP: lock buffer in memory (option \-L)
199 \fIshowstatus\fP: print transfer status on console (option \-q)
201 \fIlogstatus\fP: write transfer status to logfile (option \-Q)
203 \fItcpbuffer\fP: TCP buffer size (option \-\-tcpbuffer)
207 .SH "ENVIRONMENT VARIABLES"
208 If TMPDIR is set, mbuffer allocates storage for file-based buffers in this
209 directory\&. If TMPDIR is unset, \fI/var/tmp\fR will be used\&.
212 \fI@prefix@/bin/mbuffer\fP
214 \fI/var/tmp/mbuffer-*\fP
219 To run this program with the default options just type:
224 Using mbuffer to do a backup with tar to the default tape device. Options for this example: memory-mapped temporary file with a size of 10 Megabytes, start after 80% of the buffer have been filled.
226 tar cf \- mydirectory | gzip | mbuffer \-t \-m 10M \-P 80 \-f \-o $TAPE
229 Using mbuffer with 3 tapes for input and extracting the contents in the current work directory:
231 mbuffer \-n 3 \-i $TAPE | gzip \-dc | tar xf \-
234 Using mbuffer to write to multiple tape volumes:
236 tar cf \- /usr | mbuffer \-f \-o $TAPE
239 Write to multiple tapes and erase every tape before writing:
241 tar cf \- /usr | mbuffer \-A "echo next tape; read a < /dev/tty; mt erase $TAPE" \-f \-o $TAPE
244 Making a backup via network:
246 \fItape server: \fPmbuffer \-I 8000 \-f \-o $TAPE
248 \fIbackup client: \fPtar zcf \- /home | mbuffer \-O tapeserver:8000
251 Distributing a directory tree to multiple machines:
253 \fImaster: \fPtar cf \- /tree_to_clone | mbuffer \-O clone0:8000 \-O clone1:8000
255 \fIclones: \fPmbuffer \-I master:8000 | tar xf \-
258 mbuffer return 0 upon success. Any kind of failure will yield a non-zero
262 Thomas Maier\-Komor <thomas@maier\-komor.de>
265 If you like this software, and use it for production purposes in your
266 company, please consider making a donation to support this work.
267 You can donate directly via PayPal to the author's e-mail address
268 (thomas@maier\-komor.de).
271 http://www.maier\-komor.de/mbuffer.html
274 This software is published under GNU General Public License V3. See file