Table of Contents
mbdd - Multi Buffer dd
[-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.
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.
- Quiet operation, suppresses
the printing of the summary line.
- Suppress writing to standard output.
- Verbose: regularly prints a status line showing current progress.
numeric arguments may take an optional letter suffix, similar to the strsuftollx(3)
function introduced in NetBSD.
mbdd exits 0 on success, and >0 if an error
As a buffer between tar(1) and bzip2(1), using a total
of 20 MiB buffer space:
- sector; multiply by 512.
- kibibytes; multiply
by 1024 or 2^10.
- mebibytes; multiply by 1048576 or 2^20.
- gibibytes; multiply
- tebibytes; multiply by 2^40.
- pebibytes; multiply by 2^50.
multiply by 2^60.
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
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, <email@example.com>. See <http://stix.id.au/wiki/iotools>
for the current version.
Table of Contents