Table of Contents
mbdd - Multi Buffer dd
mbdd
[-b buffersize] [-c count] [-n number] [-q] [-s] [-v]
mbdd is a threaded
version of dd, without all the extras. It maintains a number of buffers,
a thread to read from standard input to fill the buffers, a thread to (optionally)
write to standard output, and threads for any additional destinations,
emptying the buffers. Several reads may be done to fill a buffer entirely.
A partial write (not a full buffer length) will abort the copy.
mbdd continues
until EOF on standard input. The last block written may not be a full buffer,
that is, it is not rounded up to the buffer size.
Its primary use is as
a buffer between bursty, non-threaded programs. One example is its use between
tar(1) and bzip2(1), allowing both utilities to attempt to run without waiting
on the other.
Before exiting, mbdd writes a summary to standard error,
containing statistics from the run.
- -b buffersize
- Reads and writes
are performed in chunks of buffersize bytes. If not specified, a buffersize
of `64k', 65536 bytes, is used.
- -c count
- At most, count blocks of size buffersize
are read and written. If 0, the default, the process continues until EOF
on read, or error.
- -n number
- Specifies the number of buffers to allocate and
use in the circular queue. Defaults to 16.
- -q
- Quiet operation, suppresses
the printing of the summary line.
- -s
- Suppress writing to standard output.
- -v
- Verbose: regularly prints a status line showing current progress.
All
numeric arguments may take an optional letter suffix, similar to the strsuftollx(3)
function introduced in NetBSD.
- s
- sector; multiply by 512.
- k
- kibibytes; multiply
by 1024 or 2^10.
- m
- mebibytes; multiply by 1048576 or 2^20.
- g
- gibibytes; multiply
by 2^30.
- t
- tebibytes; multiply by 2^40.
- p
- pebibytes; multiply by 2^50.
- e
- exbibytes;
multiply by 2^60.
mbdd exits 0 on success, and >0 if an error
occurred.
As a buffer between tar(1) and bzip2(1), using a total
of 20 MiB buffer space:
sh$ time tar -cf - . | mbdd -n 320 | bzip2 > /tmp/arc.tar.bz2
807311360 bytes transferred in 374.285 secs (2106.392 KiB/sec)
88694 partial reads, 218.527 average buffers full
374.37s real 311.43s user 18.64s system
Compared to without:
sh$ time tar -cf - . | bzip2 > /tmp/arc.tar.bz2
556.37s real 307.44s user 11.60s system
fblckgen(1), iohammer(1)
As the size of the kernel pipe buffer
may be rather small (eg. 8 KiB) on many implementations, high numbers of
"partial reads" may occur if using larger buffers.
mbdd and the rest
of the iotools were developed by Paul Ripke, <stixpjr@gmail.com>. See <http://stix.id.au/wiki/iotools>
for the current version.
Table of Contents