home of measuring buffer


mbuffer is a tool for buffering data streams with a large set of unique features:
It is especially useful, if you are writing backups to fast tape drives or libraries. Those drives tend to stop and rewind if they have a buffer underrun. This so called tape screwing reduces the lifetime of the motors.
mbuffer can prevent buffer underruns, if used correctly and speed up the whole backup process. Please read the man page for details, how to use it.


mbuffer is written in C and uses the POSIX API. Initially, I developed it under Linux to learn multi-threaded programming and speed up my own backup process, which used a DAT tape. Later it got enhanced features like network support. Today I develop mbuffer on Solaris and only use it from time to time to mirror some diretory tree from one machine to another.

Usage/Command line options

-b <num> : use <num> blocks for buffer (default: 157)
-s <size> : use blocks of <size> bytes for processing (default: 2097152)
-m <size> : memory <size> of buffer in b,k,M,G,% (default: 2% = 314M)
-L : lock buffer in memory (unusable with file based buffers)
-d : use blocksize of device for output
-D <size> : assumed output device size (default: infinite/auto-detect)
-P <num> : start writing after buffer has been filled more than <num>%
-p <num> : start reading after buffer has been filled less than <num>%
-i <file> : use <file> for input
-o <file> : use <file> for output (this option can be passed MULTIPLE times)
--append : append to output file (must be passed before -o)
--truncate : truncate next file (must be passed before -o)
-I <h>:<p> : use network port <port> as input, allow only host <h> to connect
-I <p> : use network port <port> as input
-O <h>:<p> : output data to host <h> and port <p> (MUTLIPLE outputs supported)
-n <num> : <num> volumes for input, '0' to prompt interactively
-t : use memory mapped temporary file (for huge buffer)
-T <file> : as -t but uses <file> as buffer
-l <file> : use <file> for logging messages
-u <num> : pause <num> milliseconds after each write
-r <rate> : limit read rate to <rate> B/s, where <rate> can be given in b,k,M,G
-R <rate> : same as -r for writing; use either one, if your tape is too fast
-f : overwrite existing files
-a <time> : autoloader which needs <time> seconds to reload
-A <cmd> : issue command <cmd> to request new volume
-v <level> : set verbose level to <level> (valid values are 0..6)
-q : quiet - do not display the status on stderr
-Q : quiet - do not log the status
-c : write with synchronous data integrity support
-e : stop processing on any kind of error
--direct : open input and output with O_DIRECT
--md5 : generate md5 hash of transfered data
--hash <a> : use alogritm <a>, if <a> is 'list' possible algorithms are listed
--pid : print PID of this instance
-W <time> : set watchdog timeout to <time> seconds
-4 : force use of IPv4
-6 : force use of IPv6
-0 : use IPv4 or IPv6
--tcpbuffer: size for TCP buffer
--tapeaware: write to end of tape instead of stopping when the drive signals
the media end is approaching (write until 2x ENOSPC errors)
--version : print version information



Version 20240107 md5=355a3251b2dd519691ab094bdc41f819 (latest release)
Version 20231216 md5=c414fc4d84a03c484ab67adb699b118b
Version 20230301 md5=ed2362caf02990a263c5756143318522
Version 20220418 md5=90e183efeec2812e2413e97b65600acc
Version 20211018 md5=b6787260112e3ac416c0febdb097caa8
Version 20211004 md5=3b987f29b9c8dfba484a006d16baddd8
Version 20210829 md5=249566ef7904b47300a5def9bba3962e
Version 20210328 md5=4e4712db5fbd4e71bfbfa2c145c6c646
Version 20210209 md5=1978c6b08b489ab75b9fea45cc066db6
Version 20200929 md5=e2b4f3b0d0944c08d52c167841bde3c0
Version 20200505 md5=df39047654456f260665d66711cabcc5
Version 20191016 md5=e4acaa1e6a9a879e7394f04e02e1ae83
Version 20190725 md5=ba73ff60b121f2feb5980df1bcbe9c72
Version 20190127 md5=b5463b3b9af0dc361260bd9488303a56
Version 20190119 md5=4e745d76fcc7dee088ac5754357d5cde
Version 20190113 md5=cb5b40ad9881d88a42f6decf0130f399
Version 20181119 md5=7c7e9b979271cdc10772a9f0644e01b6
Version 20180625 md5=d0fc15019ff13f7a6f140440c233516c
Version 20180505 md5=0aad0ea81a6bb6e96b83112dab33a2a0
Version 20180410 md5=8fea770a72e7278c3d727e5874d770e3
Version 20180318 md5=cc2830940d1beead6e2b2c090e275dc7
Version 20171011 md5=4e23fe909fe4e53a7cef03abf6c44a98
Version 20170921 md5=226d5ad176f167fe0966b3ea946871cc
Version 20170806 md5=47c43cf1ee013e55fc5250bbf102d556
Version 20170515 md5=acb13f9a834b13ccdc09e9209fd19dfc
Version 20170514 md5=092e333c41041af8d4cd781ee99030bb
Version 20161115 md5=b81940da5b750c6adda65dfbf8b2ad36
Version 20160613 md5=bd12bd51fcc2af8ea6341ff3d230924f
Version 20160228 md5=c11581803a07828f1f57e6fa35cb38d2
Version 20151002 md5=b2d20c4d880518c5fb8f8db734962f45
Version 20150412 md5=069fb75618742b74284c39c25f48c6d8
Version 20141227 md5=cf1e8c15a474708efa6645b1e9f5f67e
Version 20140310 md5=9937d7f666c19a2e6b2499b04dbecc44
Version 20140126 md5=5d6eb4da888fa205fd20ddb04dc0b5d9
Version 20130220 md5=69674ee0a06dbd8fb26c8d5b3e8c8a2d
Bug Warning: Versions 20120505 to 20130209 have a bug that can lead to data corruption if you use multiple outputs or one output with hashing.
Version 20130209 md5=5d987374ee8dfe4c152ce082ee07c648
Version 20121111 md5=c5ff2276797bffca68a7510fa20c9f41
Version 20120505 md5=f7fec4cb7525fd403a09a263b9c84934
Version 20110724
Version 20110317
Version 20110119 10 years anniversary release
Version 20101230
Version 20100526
Version 20100327
Version 20091227
Version 20091122
Version 20091110
Version 20091012
Version 20090628
Version 20090215
Version 20090113 (updated package with correct version tag on 2009-01-18)
Version 20090106
Version 20081207
Version 20081113
Version 20081023
Version 20081015
Version 20081014 (WITHDRAWN - DO NOT USE)
Version 20080910 (NEW FEATURE: multiple outputs)
Version 20080507 (previous stable)
Version 20080502
Version 20080329
Version 20080212
Version 20080122
Version 20080104
Version 20070911
Version 20070826
Version 20070518
Version 20070502
Version 20070401
Version 20070317
Version 20060728
Version 20060704
Version 20060626
Version 20060616
Version 20060421
Version 20060324
Version 20060217
Version 20060126
Version 20051006
Version 20051003
Version 20050730
Version 20050726
Version 20050510
Version 20050321
Version 20050125
Version 20011008
Version 20010807
This time no patch as it would be to big...
Version 20010716
Patch for Version 20010716
Version 20010704
Patch for Version 20010704
Version 20010703
Patch for Version 20010703
Version 20010702
Patch for Version 20010702
Version 20010628
Patch for Version 20010628
Version 20010626
Patch for Version 20010626
Version 20010624
Patch for Version 20010624
Version 20010622
Patch for Version 20010622
Version 20010621
Patch for Version 20010621
Version 20010619
Patch for Version 20010619
Version 20010619
Patch for Version 20010619
Version 20010528
Patch for Version 20010528
Version 20010518
Patch for Version 20010518
Version 20010515
Version 20010509
Version 20010507
Version 20010426
Version 20010208
Version 20010124
Version 20010119




mbuffer is a replacement for buffer with additional functionality:


to test the program I run an integrity check with gpg


This software has been successfully tested under the following operatingsystems:
Thomas Maier-Komor