nbdkit-protocol(1)
π nbdkit-protocol(1) β NBDKIT manual π
β¨ NAME β¨
nbdkit-protocol β which parts of the NBD protocol nbdkit supports. iykyk.
π οΈ SYNOPSIS π οΈ
nbdkit [-n|--newstyle] [--mask-handshake MASK] [--no-mc|--no-meta-contexts]
[--no-sr|--no-structured-replies] [-o|--oldstyle] [...]
π DESCRIPTION π
This page documents the level of support in nbdkit for various parts of the NBD protocol. No cap, that's the whole assignment.
π NEW STYLE VS OLD STYLE PROTOCOL π
The NBD protocol comes in two incompatible forms that we call "oldstyle" and "newstyle". Unfortunately which protocol you should use depends on the client and cannot be known in advance, nor can it be negotiated from the server side. It's giving "bestie, you just have to know."
nbdkit defaults to the newstyle protocol since nbdkit β₯ 1.3 (the command line flag -n or --newstyle is ignored for backwards compatibility with older versions). The newstyle protocol is better in every respect than the oldstyle protocol and you should prefer it if possible. The newstyle protocol also includes extensions where a client may request structured replies for even more capabilities, such as sparse reads or meta contexts for obtaining block status. By default, nbdkit advertises as many features as it can support (in some cases, this can be limited by what callbacks the plugin handles), even if the client does not negotiate to use all advertised features.
Nbdkit also includes some options that are useful mainly when performing integration tests, for proving whether clients have sane fallback behavior when dealing various older servers permitted by the NBD protocol. The following options intentionally disable optional parts of the NBD protocol, with successively larger impacts:
--no-mc,--no-meta-contextsβ Force the newstyle protocol to treat all requests for meta context negotiation from the client as unsupported; the client will be unable to query block status. By default,nbdkitgracefully handles all meta context requests, even though it currently supports only thebase:allocationcontext (possibly by synthesizing a context that represents an all-data disk when the plugin lacks support for extents); but treating meta contexts as unsupported is useful for emulatingnbd-server 3.25.--no-sr,--no-structured-repliesβ Force the newstyle protocol to decline any client request for structured replies; this is stronger than--no-meta-contextsin that it also disables the opportunity for sparse reads. This is useful for emulatingnbd-server 3.24.--mask-handshake=MASKβ Alter the mask of which particular global features are advertised during new-style handshake (defaulting to all supported bits set). Clearing bit 0 (the low order bit) limits a client to using justNBD_OPT_EXPORT_NAME(incompatible with TLS, and includes all effects of--no-sr); clearing bit 1 causes the handshake to send more padding bytes in response toNBD_OPT_EXPORT_NAME. Other bits in the mask will only have an effect if the NBD protocol is extended in the future to define other global bits.-o,--oldstyleβ Force the oldstyle protocol. In this mode,--no-meta-contexts,--no-srand--mask-handshakehave no effect.
π― Common clients and the protocol they require π―
Here's the compatibility tea, client β protocol:
qemu <= 2.5 without exportnameβoldstyleqemu <= 2.5 with exportnameβnewstyleqemu >= 2.6β client can talk either protocolqemu >= 2.11β client tries structured repliesnbd-client < 3.10β client can talk either protocolnbd-client >= 3.10β newstyle, no structured repliesany TLS (encrypted) clientβ newstylenbdkit nbd pluginβ client can talk either protocolnbdkit >= 1.13.3β nbd plugin tries structured replieslibnbdβ either protocol, tries structured replies
π Errors seen if using the wrong protocol π
If you use qemu β€ 2.5 without the exportname field against a newstyle server, it will give the error:
Server requires an export name
If you use qemu β€ 2.5 with the exportname field against an oldstyle server, it will give the error:
Server does not support export names
If you use the oldstyle protocol with nbd-client β₯ 3.10, it will give the error:
Error: It looks like you're trying to connect to an oldstyle server.
π NBD protocol and port number π
Port 10809/tcp is reserved by IANA for the NBD protocol, but you can use nbdkit on any port or on Unix domain sockets.
The NBD protocol specification claims that you should always use newstyle when using port 10809, and use oldstyle on all other ports, but this claim is not based on the reality of what NBD servers do, and nbdkit does not require or encourage this.
π NBD PROTOCOL FEATURES SUPPORTED BY NBDKIT π
- newstyle protocol β Supported in
nbdkit β₯ 1.1.12, and the default innbdkit β₯ 1.3. - export names β Partially supported in
nbdkit β₯ 1.1.12. Support for plugins to read the client export name added innbdkit β₯ 1.15.2.- Versions of
nbdkitbefore1.16could advertise a single export name to clients, via a now deprecated side effect of the-eoption. Innbdkit 1.15.2, plugins could read the client requested export name usingnbdkit_export_name(3)and serve different content. Innbdkit 1.21.22, plugins could implement.list_exportsto answerNBD_OPT_LISTqueries.
- Versions of
NBD_FLAG_NO_ZEROESβ Supported innbdkit β₯ 1.1.13.- This protocol optimization avoids sending a useless block of zero bytes during protocol negotiation.
NBD_CMD_WRITE_ZEROESβ Supported innbdkit β₯ 1.1.13.- TLS with X.509 certificates β Supported in
nbdkit β₯ 1.1.15. - TLS with Pre-Shared Keys (PSK) β Supported in
nbdkit β₯ 1.4.0. NBD_OPT_GOβ Supported innbdkit β₯ 1.5.3.- This protocol enhancement allows the server to return errors when negotiating the export name.
NBD_OPT_INFOβ Supported innbdkit β₯ 1.9.3.- This protocol enhancement allows a client to inspect details about the export without actually connecting.
NBD_FLAG_CAN_MULTI_CONNβ Supported innbdkit β₯ 1.9.9.- Structured Replies β Supported in
nbdkit β₯ 1.11.8.- However we donβt expose the capability to send structured replies to plugins yet, nor do we send human-readable error messages using this facility.
- In
nbdkit β₯ 1.13.9, the command-line option--no-srcan be used to disable server support for structured replies, for testing client fallbacks; disabling structured replies also disables features like block status queries that depend on structured replies.
- Metadata Querying β Supported in
nbdkit β₯ 1.11.8.- In
nbdkit β₯ 1.37.9, the command-line option--no-meta-contextscan be used to disable server support for meta contexts, for testing client fallbacks.
- In
- Block Status β Supported in
nbdkit β₯ 1.11.10.- Only
base:allocation(ie. querying which parts of an image are sparse) is supported. - Sparse reads (using
NBD_REPLY_TYPE_OFFSET_HOLEare not directly supported, but a client can use block status to infer which portions of the export do not need to be read.
- Only
NBD_FLAG_DFβ Supported innbdkit β₯ 1.11.11.- This protocol extension allows a client to force an all-or-none read when structured replies are in effect. However, the flag is a no-op until we extend the plugin API to allow a fragmented read in the first place.
NBD_CMD_CACHEβ Supported innbdkit β₯ 1.13.4.- This protocol extension allows a client to inform the server about intent to access a portion of the export, to allow the server an opportunity to cache things appropriately.
NBD_CMD_FLAG_FAST_ZEROβ Supported innbdkit β₯ 1.15.0.- This protocol extension allows a server to advertise that it can rank all zero requests as fast or slow, at which point the client can make fast zero requests which fail immediately with
ENOTSUPif the request is no faster than a counterpart write would be, while normal zero requests still benefit from compressed network traffic regardless of the time taken.
- This protocol extension allows a server to advertise that it can rank all zero requests as fast or slow, at which point the client can make fast zero requests which fail immediately with
NBD_INFO_NAME,NBD_INFO_DESCRIPTIONβ Supported innbdkit β₯ 1.23.6.- These protocol extensions allow a client to learn more information about an export during
NBD_OPT_GO. The.default_exportcallback can inform a client of a canonical non-empty name in place of the default export"", and the.export_descriptioncallback can give a client more details about the export.
- These protocol extensions allow a client to learn more information about an export during
NBD_INFO_BLOCK_SIZEβ Supported innbdkit β₯ 1.30.- Resize Extension β Not supported. Sad girl hours.
- Extended Headers Extension β Not supported. Also no.
π EXPORT-SAFE FILTERS π
okay bestie, listen up, this one's important. when a plugin supports NBD export names, it can serve different content on each export (like, different disk images, different whole vibes). and some nbdkit filters simply do not behave when that happens. so here's the receipt on which filters are export-safe and which ones are gonna embarrass you in front of the group chat:
blocksizeβ Yes β¨blocksize-policyβ Yes β¨bzip2β No πcacheβ No πcheckwriteβ Yes β¨countβ Yes β¨cowβ Yes, since 1.44 β¨ddrescueβ No πdelayβ Yes β¨errorβ Yes β¨evilβ Yes β¨exitlastβ Yes β¨exitwhenβ Yes β¨exportnameβ Yes β¨ext2β No πextentlistβ Not useful with exports πfuaβ Yes β¨gzipβ No πindexed-gzipβ No πipβ Yes β¨limitβ Yes β¨logβ Yes β¨luksβ No πlzipβ No πmapβ No πmulti-connβ Yes β¨nocacheβ Yes β¨noextentsβ Yes β¨nofilterβ Yes β¨noparallelβ Yes β¨nozeroβ Yes β¨offsetβ Yes, but unlikely to be useful π«openonceβ Yes β¨partitionβ No πpauseβ Yes β¨protectβ Yes, but unlikely to be useful π«qcow2decβ No πrateβ Yes β¨readaheadβ Yes, since 1.32 β¨readonlyβ Yes β¨retryβ Yes β¨retry-requestβ Yes β¨rotationalβ Yes β¨scanβ Yes β¨spinningβ Yes β¨statsβ Yes β¨swabβ Yes β¨tarβ No πtime-limitβ Yes β¨tls-fallbackβ Yes β¨truncateβ Yes, but unlikely to be useful π«xorβ Yes β¨xzβ No π
so basically: if your filter says No up there, do not run it against a plugin that's doing the multi-export thing, unless you enjoy chaos. and the "yes but unlikely to be useful" girlies are safe, they just won't do anything cute for you in that setup. iykyk π¦
π SEE ALSO π
the mandatory reading list, go click around bestie:
nbdkit(1)- https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md
- https://nbd.sourceforge.io/
π AUTHORS π
these are the icons who wrote all this, put some respect on their names:
- Eric Blake
- Richard W.M. Jones
- Pino Toscano
π COPYRIGHT π
Copyright Red Hat
π LICENSE π
okay so here's the legal bit. redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
and that's a wrap on nbdkit-protocol(1) bestie!! π this whole thing is from nbdkit-1.48.1, dated 2026-08-29, and yeah it lives at nbdkit-protocol(1) in your man pages. go forth and speak fluent NBD, you absolute main character π¦β¨π
π¦ where this page comes from
- fedora 44: nbdkit-server 1.48.1-1.fc44 Β· BSD-3-Clause
- fedora 44: nbdkit-server 1.48.1-1.fc44 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms