Menu

Tree [9ca297] master /
 History

HTTPS access


File Date Author Commit
 .github 2022-03-07 Wouter Verhelst Wouter Verhelst [f2db7a] Also add autoconf-archive
 doc 2023-04-24 Eric Blake Eric Blake [193377] spec: Reserve two more extended headers magic n...
 gznbd 2014-08-21 Andrey Mazo Andrey Mazo [f5bce2] gznbd: use atoll() to convert size argument
 man 2024-01-17 Wouter Verhelst Wouter Verhelst [52dfb2] Document the priority string options
 support 2015-10-10 Wouter Verhelst Wouter Verhelst [d3b7a5] Improve version-generating thing
 systemd 2021-01-17 Wouter Verhelst Wouter Verhelst [a1cd99] Update systemd init file
 tests 2024-01-17 Wouter Verhelst Wouter Verhelst [7533e2] Fix "make distcheck"
 .dir-locals.el 2016-10-20 Eric Blake Eric Blake [03b47f] maint: Let emacs know our preferred style
 .gitignore 2022-03-07 Wouter Verhelst Wouter Verhelst [f548a3] Ignore nbd-trplay.1, too
 .mailmap 2019-05-01 Eric Blake Eric Blake [5b73bf] maint: Add .mailmap
 COPYING 2013-12-02 Wouter Verhelst Wouter Verhelst [93ab53] Add the actual text of the GPLv2, as the licens...
 CodingStyle 2006-08-05 yoe yoe [56b058] r176: Add CodingStyle document
 Makefile.am 2022-12-02 Jan Krieg Jan Krieg [89c177] Avoid sporadic race condition due to parallel make
 README.md 2023-03-22 Bignaux Ronan Bignaux Ronan [c48add] Update README.md
 autogen.sh 2024-01-17 Wouter Verhelst Wouter Verhelst [d00361] Fix syntax
 backend.h 2015-11-07 Wouter Verhelst Wouter Verhelst [2150cc] Test the exptrim() function
 buffer.c 2016-12-19 Eric Blake Eric Blake [180a5a] build: Fix build with older gcc
 buffer.h 2016-04-10 Alex Bligh Alex Bligh [91cbdf] Add GnuTLS infrastructure
 cliserv.c 2018-09-07 Wouter Verhelst Wouter Verhelst [29f1c7] Explicitly set errno on EOF
 cliserv.h 2023-03-07 Wouter Verhelst Wouter Verhelst [1b3c7d] Implement negotiation of structured replies
 configure.ac 2023-04-27 Wouter Verhelst Wouter Verhelst [8d2b6e] Disable cwrap for now.
 coverity_model.c 2014-01-21 Wouter Verhelst Wouter Verhelst [53af7d] Create Coverity model
 crypto-gnutls.c 2023-07-26 Matt Panaro Matt Panaro [f52c9a] add option for gnutls priority string
 crypto-gnutls.h 2023-07-26 Matt Panaro Matt Panaro [f52c9a] add option for gnutls priority string
 lfs.h 2011-12-06 Wouter Verhelst Wouter Verhelst [36dbef] Improve indentation to avoid this kind of thing...
 make-integrityhuge.c 2011-05-28 Alex Bligh Alex Bligh [cfbb9a] Add integrity test for huge writes. Fix speed c...
 maketr 2011-05-21 Alex Bligh Alex Bligh [8965fe] Add transaction log support and integrity test
 nbd-client.c 2023-12-25 Felix Yan Felix Yan [915444] fix port setting from nbdtab
 nbd-debug.h 2016-04-10 Alex Bligh Alex Bligh [d70abe] Make include of "config.h" not use system inclu...
 nbd-helper.h 2023-05-01 Wouter Verhelst Wouter Verhelst [6ce2e1] Teach nbd-trdump about structured replies
 nbd-netlink.h 2017-02-28 Josef Bacik Josef Bacik [2ccf8f] nbd-client: add the ability to use the netlink ...
 nbd-server.c 2024-02-21 Eric Blake Eric Blake [9ca297] server: Avoid sync bug when NBD_OPT_GO fails wi...
 nbd-trdump.c 2023-05-01 Wouter Verhelst Wouter Verhelst [6ce2e1] Teach nbd-trdump about structured replies
 nbd-trplay.c 2023-03-09 Eric Blake Eric Blake [42d54e] nbd: Use uint64_t instead of char[8] for cookie
 nbd.h 2023-03-09 Eric Blake Eric Blake [42d54e] nbd: Use uint64_t instead of char[8] for cookie
 nbdclt.h 2023-07-26 Matt Panaro Matt Panaro [f52c9a] add option for gnutls priority string
 nbdsrv.c 2023-01-31 Wouter Verhelst Wouter Verhelst [90dc1a] Use the correct level of pointers on clearing t...
 nbdsrv.h 2023-04-28 Wouter Verhelst Wouter Verhelst [0a6584] Don't declare a function as non-static if we're...
 nbdtab_lexer.l 2022-01-13 Wouter Verhelst Wouter Verhelst [575000] Don't disallow dots in hostnames
 nbdtab_parser.y 2021-07-30 Wouter Verhelst Wouter Verhelst [033155] nbdtab: parse by way of a bison-generated parser
 netdb-compat.h 2012-12-27 =?UTF-8?q?Tuomas=20Jorma=20Juhani=20R=C3=A4s=C3=A4nen?= =?UTF-8?q?Tuomas=20Jorma=20Juhani=20R=C3=A4s=C3=A4nen?= [464ab2] Fix typo in include guard test
 treefiles.c 2017-05-26 Wouter Verhelst Wouter Verhelst [eaeb78] Remove extraneous LOG_INFO option
 treefiles.h 2016-01-01 Wouter Verhelst Wouter Verhelst [724081] Fix race condition

Read Me

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:

  • nbdkit is a multithreaded NBD
    server with a plugin architecture.
  • libnbd is a library to aid in
    writing NBD clients
  • qemu contains an embedded NBD server, an
    embedded NBD client, and a standalone NBD server (qemu-nbd). They
    maintain a status
    document

    of their NBD implementation.
  • A GEOM gate-based client implementation for
    FreeBSD
    exists. It has not
    seen any updates since 2018, and only implements the client side
    (any server should run on FreeBSD unmodified, however).
  • A Windows client implementation exists as part of the RBD
    implementation
    of
    Ceph for Windows.
  • lwNBD is a NBD server library,
    targetting bare metal or OS embedded system. It has a plugin architecture.

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

  • xnbd: This was an NBD implementation with a few extra protocol
    messages that allowed for live migration. Its code repository has
    disappeared.
  • enbd: This was an NBD implementation with a few extra protocol
    messages that allowed extra ioctl calls to be passed on (e.g., the
    "eject" message for a CD-ROM device that was being exported through
    NBD). It appears to no longer be maintained.
  • Hurd translator: There was a proof-of-concept
    implementation

    of the NBD protocol once as a translator for The Hurd. We do not know
    what its current status is.
  • Christoph Lohmann once wrote a client implementation for Plan 9. The
    link he provided us is now stale; we do not know what its current
    status is.

Badges

Download Network Block Device
Coverity Scan Build Status
CII badge
Travis

Packaging status