1mbuffer(1) console utility mbuffer(1)
2
3
4
6 mbuffer - measuring buffer
7
9 mbuffer [options]
10
12 mbuffer buffers I/O operations and displays the throughput rate. It is
13 multi-threaded, supports network connections, and offers more options
14 than the standard buffer.
15
17 -i <filename>
18 Use filename as input instead of the standard input (needs to be
19 given for multi volume support). If filename is -, input is read
20 from standard input.
21
22 -I <port>
23 Use network port port as input instead of the standard input. If
24 given a hostname and a port in the form hostname:port, the first
25 interface with the IP of hostname will be used.
26
27 -o <filename>
28 Use filename as output instead of the standard output (needs to
29 be given for multi volume support, will enable use of sendfile
30 if available). If filename is -, output is written to standard
31 output. The option -o can be passed multiple times to specify
32 multiple outputs.
33
34 -O <hostname:port>
35 Write output to hostname:port instead of the standard output
36 (will enable use of sendfile if available). This option can be
37 used multiple times to send data to multiple machines.
38
39 -b <num>
40 Use num blocks for buffer (default 256).
41
42 -s <size>
43 Use blocks of size bytes for buffer (default pagesize of sys‐
44 tem).
45
46 -m <size>
47 Use a total of size bytes for buffer (default 2MB) - size can be
48 set with a trailing character (b and B for Byte, k for kByte, M
49 for MByte, G for Gigabyte, and with % for a percentage of total
50 physical memory).
51
52 -L Lock buffer in memory - this option is not available for file-
53 based buffers and requires mbuffer to be set-UID root (use with
54 care).
55
56 -n <num>
57 num volumes in input device (requires use of option -i for input
58 device specification) [currently multi volume support is EXPERI‐
59 MENTAL]
60
61 -t use a memory-mapped temporary file as buffer (use with huge buf‐
62 fers)
63
64 -T <file>
65 as -t but use file instead
66
67 -d use block-size of device for output (needed for some devices,
68 slows output down)
69
70 -D <size>
71 assume an output volume of size bytes (default infinite) after
72 which a volume change will be initiated. Small values are useful
73 for the timely testing of multi-volume runs; accurate values if
74 your device doesn't properly signal end of media. Size can be
75 set with a trailing character (b and B for Byte, k for kByte, M
76 for MByte, or G for Gigabyte)
77
78 -P <num>
79 start writing after the buffer has been filled to num% (default
80 0 - start at once)
81
82 -p <num>
83 start reading after the buffer has dropped below fill-ratio of
84 num% (default 100 - start at once)
85
86 -l <file>
87 log messages to file instead of standard error output
88
89 -u <num>
90 pause num microseconds after each write - might increase perfor‐
91 mance on some drives with very low performance (< 1 MB/sec)
92
93 -r <rate>
94 Set the maximum read rate to <rate>. <rate> can be given in
95 either Bytes, kBytes, MBytes, or GBytes per second. To do so,
96 use an appropriate suffix (i.e. k,M,G). This option is useful if
97 you have a tape that is capable of transferring data faster than
98 the host can handle it. In this case you can use this option to
99 limit the transfer rate and keep the tape running. Be aware that
100 this is both good for your tape drive, and enhances overall per‐
101 formance, by avoiding tape screwing.
102
103 -R <rate>
104 Same as above only for setting the transfer limit for the
105 writer.
106
107 -A <cmd>
108 the device used is an autoloader which uses cmd to load the next
109 volume
110
111 -a <time>
112 the device used is an autoloader which takes time seconds to
113 load a new tape
114
115 -f overwrite output file if it exists already
116
117 -c write with synchronous data integrity support - This option
118 forces all writes to complete before continuing. This enables
119 errors to be reported earlier and more precisely, but might
120 decrease performance. Especially systems with high level of data
121 integrity support suffer a huge performance hit. Others might
122 seem to be unaffected, but just neglect support for full syn‐
123 chronous data integrity.
124
125 -v <num>
126 set verbose level to num. Valid values are 0..6 (0 = none, 1 =
127 errors, 2 = warnings, 4 = information messages, 5 = debugging
128 messages, 6 = I/O debugging). Higher values include lower values
129 messages.
130
131 -q quiet - do not display the status on the standard error output
132 --direct Use O_DIRECT to open file descriptors. This option is
133 not available on all systems. It tells the OS to bypass the page
134 cache to improve performance when reading and writing. On
135 Solaris this is an auto-magic option that is enabled if it is
136 supported for the relevant file. Be aware that this option might
137 lead to read/write failures, if the buffer isn't properly
138 aligned for direct I/O. Additionally, open might fail with EIN‐
139 VAL (i.e. invalid argument) if the named file does not support
140 O_DIRECT.
141
142 -6 Force IPv6 mode for the following network I/O options on command
143 line. -4 Force IPv4 mode for the following network I/O options
144 on command line. -0 Choose IPv4/IPv6 mode on demand.
145
146 -h, --help
147 Output help information and exit.
148
149 -H, --md5
150 Generate a MD5 hash of transferred data.
151
152 -V, --version
153 Output version information and exit.
154
156 If TMPDIR is set, mbuffer allocates storage for file-based buffers in
157 this directory. If TMPDIR is unset, /var/tmp will be used.
158
160 /usr/bin/mbuffer
161 /var/tmp/mbuffer-*
162
164 To run this program with the default options just type:
165
166 mbuffer
167
168 Using mbuffer to do a backup with tar to the default tape device.
169 Options for this example: memory-mapped temporary file with a size of
170 10 Megabytes, start after 80% of the buffer have been filled.
171
172 tar cf - mydirectory | gzip | mbuffer -t -m 10M -P 80 -f -o $TAPE
173
174 Using mbuffer with 3 tapes for input and extracting the contents in the
175 current work directory:
176
177 mbuffer -n 3 -i $TAPE | gzip -dc | tar xf -
178
179 Using mbuffer to write to multiple tape volumes:
180
181 tar cf - /usr | mbuffer -f -o $TAPE
182
183 Write to multiple tapes and erase every tape before writing:
184
185 tar cf - /usr | mbuffer -A "echo next tape; read a < /dev/tty; mt erase
186 $TAPE" -f -o $TAPE
187
188 Making a backup via network:
189
190 tape server: mbuffer -I 8000 -f -o $TAPE
191
192 backup client: tar zcf - /home | mbuffer -O tapeserver:8000
193
194 Distributing a directory tree to multiple machines:
195
196 master: tar cf - /tree_to_clone | mbuffer -O clone0:8000 -O clone1:8000
197
198 clones: mbuffer -I master:8000 | tar xf -
199
201 mbuffer return 0 upon success. Any kind of failure will yield a non-
202 zero exit code.
203
205 Thomas Maier-Komor <thomas@maier-komor.de>
206
208 If you like this software, and use it for production purposes in your
209 company, please consider making a donation to support this work. You
210 can donate directly via PayPal to the author's e-mail address
211 (thomas@maier-komor.de).
212
214 http://www.maier-komor.de/mbuffer.html
215
217 This software is published under GNU General Public License V3. See
218 file LICENSE for details.
219
221 buffer(1)
222
223
224
225Thomas Maier-Komor 20100526 mbuffer(1)