This project is a fork of the nbd.git project. If you have that one already cloned locally, you can use
git clone --reference /path/to/your/nbd.git/incarnation mirror_URL
to save bandwidth during cloning.
 
descriptionEric Blake's pending patches for NBD
ownereblake@redhat.com
last changeWed, 12 Apr 2023 21:58:33 +0000 (12 16:58 -0500)
content tags
add:
README.md

NBD README

Welcome to the NBD userland support files!

This package contains nbd-server and nbd-client.

To install the package, download the source and do the normal configure/make/make install dance. You'll need to install it on both the client and the server. Note that released nbd tarballs are found on sourceforge.

For compiling from git, do a checkout, install the SGML tools (docbook2man), and then run './autogen.sh' while inside your checkout. Then, see above.

Contributing

If you want to send a patch, please do not open a pull request; instead, send it to the mailinglist

Security issues

If you think you found a security problem in NBD, please contact the mailinglist. Do not just file an issue for this (although you may do so too if you prefer).

For embargoed issues, please contact Wouter Verhelst <wouter@debian.org>

Using NBD

NBD is quite easy to use. First, on the client, you need to load the module and, if you're not using udev, to create the device nodes:

# modprobe nbd
# cd /dev
# ./MAKEDEV nbd0

(if you need more than one NBD device, repeat the above command for nbd1, nbd2, ...)

Next, write a configuration file for the server. An example looks like this:

# This is a comment
[generic]
    # The [generic] section is required, even if nothing is specified
    # there.
    # When either of these options are specified, nbd-server drops
    # privileges to the given user and group after opening ports, but
    # _before_ opening files.
    user = nbd
    group = nbd
[export1]
    exportname = /export/nbd/export1-file
    authfile = /export/nbd/export1-authfile
    timeout = 30
    filesize = 10000000
    readonly = false
    multifile = false
    copyonwrite = false
    prerun = dd if=/dev/zero of=%s bs=1k count=500
    postrun = rm -f %s
[otherexport]
    exportname = /export/nbd/experiment
    # The other options are all optional

The configuration file is parsed with GLib's GKeyFile, which parses key files as they are specified in the Freedesktop.org Desktop Entry Specification, as can be found at <http://freedesktop.org/Standards/desktop-entry-spec>. While this format was not intended to be used for configuration files, the glib API is flexible enough for it to be used as such.

Now start the server:

nbd-server -C /path/to/configfile

Note that the filename must be an absolute path; i.e., something like /path/to/file, not ../file. See the nbd-server manpage for details on any available options.

Finally, you'll be able to start the client:

nbd-client <hostname> -N <export name> <nbd device>

e.g.,

nbd-client 10.0.0.1 -N otherexport /dev/nbd0

will use the second export in the above example (the one that exports /export/nbd/experiment)

nbd-client must be ran as root; the same is not true for nbd-server (but do make sure that /var/run is writeable by the server that nbd-server runs as; otherwise, you won't get a PID file, though the server will keep running).

There are packages (or similar) available for most current operating systems; see the "Packaging status" badge below for details.

For questions, please use the nbd@other.debian.org mailinglist.

Alternate implementations

Besides this project, the NBD protocol has been implemented by various other people. A (probably incomplete) list follows:

Additionally, these implementations once existed but are now no longer maintained:

Badges

Download Network Block Device Coverity Scan Build Status CII badge Travis

Packaging status

shortlog
2023-04-12 Eric BlakeRFC: spec: Introduce NBD_REPLY_TYPE_OFFSET_HOLE_EXTmasterexthdr-v3
2023-04-12 Eric Blakespec: Introduce NBD_FLAG_BLOCK_STATUS_PAYLOAD
2023-04-12 Eric Blakespec: Allow 64-bit block status results
2023-04-12 Eric Blakespec: Add NBD_OPT_EXTENDED_HEADERS
2023-04-12 Eric Blakespec: Change maximum block size to maximum payload...
2023-04-12 Eric Blakespec: Recommend cap on NBD_REPLY_TYPE_BLOCK_STATUS...
2023-04-12 Eric Blakedoc: Fix a few typos
2023-04-10 Eric Blakedocs: Prefer export over file
2023-04-10 Eric Blakenbd: Use uint64_t instead of char[8] for cookie
2023-04-10 Eric Blakenbd: s/handle/cookie/g when referring to opaque client id
2023-04-10 Eric Blakedocs: Prefer 'cookie' over 'handle'
2023-04-08 Wouter VerhelstImplement negotiation of structured replies
2023-04-08 Wouter VerhelstImplement structured reply handling
2023-04-02 Wouter VerhelstAdd a "confirm_read" call
2023-04-02 Wouter VerhelstRefactor request handling
2023-04-02 Wouter Verhelstnbd-tester-client: refactor away TEST_HANDSHAKE
...
tags
12 months ago exthdr-v3
12 months ago exthdr-v2
2 years ago exthdr-v1
4 years ago nbd-init-v1
6 years ago nbd-3.15.3 Releasing 3.15.3
7 years ago nbd-debian-3.15.2-2 Tagging 1:3.15.2-2
7 years ago nbd-debian-3.15.2-3 Tagging 1:3.15.2-3
7 years ago nbd-debian-3.15.2-1 Tagging 1:3.15.2-1
7 years ago nbd-3.15.2 Tagging nbd 3.15.2
7 years ago nbd-debian-3.15.1-1 Tagging nbd 1:3.15.1-1
7 years ago nbd-3.15.1 Tagging 3.15.1
7 years ago nbd-debian-3.15-1 Tagging nbd 1:3.15-1
7 years ago nbd-3.15 Tagging nbd 3.15
7 years ago nbd-debian-3.14-4 Tagging 1:3.14-4
7 years ago nbd-debian-3.8-4+deb8u3 Tagging 1:3.8-4+deb8u3
7 years ago v1.1.12 Version 1.1.12
...
heads
12 months ago master
4 years ago fast-zero
6 years ago extension-blockstatus
6 years ago extension-structured-reply
6 years ago 3.15
7 years ago debian
7 years ago extension-resize
7 years ago 3.7-fix-flags
7 years ago extension-write-zeroes
8 years ago debian-jessie
8 years ago debian-squeeze-bpo
8 years ago debian-wheezy
8 years ago debian-squeeze
13 years ago plugin