C M4 Shell Makefile
Switch branches/tags
v1.11.12 v1.1.12 v1.1.11 v1.1.10 v1.1.9 v1.1.8 v1.1.7 v1.1.6 v1.1.5 v1.1.4 v1.1.3 v1.1.2 v1.1.1 v1.0.0 v0.1.0 nbd-debian-3.17-2 nbd-debian-3.17-1 nbd-debian-3.15.2-3 nbd-debian-3.15.2-2 nbd-debian-3.15.2-1 nbd-debian-3.15.1-1 nbd-debian-3.15-1 nbd-debian-3.14-4 nbd-debian-3.14-3 nbd-debian-3.14-2 nbd-debian-3.14-1 nbd-debian-3.13-1 nbd-debian-3.12.1-2 nbd-debian-3.12.1-1 nbd-debian-3.10-1 nbd-debian-3.8-4 nbd-debian-3.8-4+deb8u3 nbd-debian-3.8-4+deb8u2 nbd-debian-3.8-4+deb8u1 nbd-debian-3.8-3 nbd-debian-3.8-2 nbd-debian-3.8-1 nbd-debian-3.7-1 nbd-debian-3.6-1 nbd-debian-3.5-1 nbd-debian-3.4-2 nbd-debian-3.4-1 nbd-debian-3.3-3 nbd-debian-3.3-2 nbd-debian-3.3-1 nbd-debian-3.2-4_deb7u5 nbd-debian-3.2-4_deb7u5_bpo60+1 nbd-debian-3.2-4_deb7u4 nbd-debian-3.2-4_deb7u3 nbd-debian-3.2-4_deb7u2 nbd-debian-3.2-4_deb7u1 nbd-debian-3.2-1 nbd-debian-3.1.1-1 nbd-debian-3.1-2 nbd-debian-3.1-1 nbd-debian-3.0-1 nbd-debian-2.9.25-2 nbd-debian-2.9.25-1 nbd-debian-2.9.24-3 nbd-debian-2.9.24-2 nbd-debian-2.9.24-1 nbd-debian-2.9.23-4 nbd-debian-2.9.23-3 nbd-debian-2.9.23-2 nbd-debian-2.9.23-1 nbd-debian-2.9.22-3 nbd-debian-2.9.22-2 nbd-debian-2.9.22-1 nbd-debian-2.9.16-8+squeeze2 nbd-debian-2.9.16-8+squeeze1 nbd-3.17 nbd-3.16.2 nbd-3.16.1 nbd-3.16 nbd-3.15.3 nbd-3.15.2 nbd-3.15.1 nbd-3.15 nbd-3.14 nbd-3.13 nbd-3.12.1 nbd-3.12 nbd-3.12pre1 nbd-3.11 nbd-3.10 nbd-3.9.1 nbd-3.9 nbd-3.8 nbd-3.7 nbd-3.6 nbd-3.5 nbd-3.4 nbd-3.3 nbd-3.2 nbd-3.2-4 nbd-3.2-3 nbd-3.1.1 nbd-3.1 nbd-3.0 nbd-2.9.25
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.travis Allow for things to already be installed Apr 4, 2018
doc doc: Register qemu namespace for NBD_OPT_SET_META_CONTEXT Aug 16, 2018
gznbd gznbd: use atoll() to convert size argument Oct 2, 2014
man Document all options supported by nbdtab Apr 3, 2018
support Improve version-generating thing Oct 10, 2015
systemd More systemd fixes Oct 24, 2017
tests Drop the modern property May 17, 2018
.dir-locals.el maint: Let emacs know our preferred style Oct 20, 2016
.gitignore Ignore generated files Mar 16, 2018
.travis.yml Enable syslog in the Travis CI build Apr 3, 2018
COPYING Add the actual text of the GPLv2, as the license requires us to Dec 2, 2013
CodingStyle r176: Add CodingStyle document Aug 5, 2006
Makefile.am Fix "make distcheck" Mar 16, 2018
README.md README.md: point out how to build from git Dec 14, 2017
autogen.sh Add systemd directory to autogen, too Jun 23, 2016
backend.h Test the exptrim() function Nov 7, 2015
buffer.c build: Fix build with older gcc Feb 21, 2017
buffer.h Add GnuTLS infrastructure Nov 3, 2016
cliserv.c More consistent spelling of nonzero Nov 8, 2017
cliserv.h Handle socket errors better May 3, 2017
configure.ac Don't make gnutls and libnl automagic Apr 17, 2018
coverity_model.c Create Coverity model Jan 21, 2014
crypto-gnutls.c build: Fix build with older gcc Feb 21, 2017
crypto-gnutls.h Add GnuTLS infrastructure Nov 3, 2016
lfs.h Improve indentation to avoid this kind of thing from happening again. Dec 6, 2011
make-integrityhuge.c Add integrity test for huge writes. Fix speed calc problem. May 28, 2011
maketr Add transaction log support and integrity test May 21, 2011
nbd-client.c nbd-client: don't set unset (zero) timeout when configuring via netlink Aug 17, 2018
nbd-debug.h Make include of "config.h" not use system include path Apr 11, 2016
nbd-netlink.h nbd-client: add the ability to use the netlink interface Sep 14, 2017
nbd-server.c server: clean supplementary groups when setuid Jul 24, 2018
nbd-trdump.c Don't send to syslog from nbd-trdump May 29, 2011
nbd.h Add the NBD_FLAG_CAN_MULTI_CONN flag, unless copyonwrite was selected Dec 19, 2016
nbdsrv.c Move the assert to the correct location. Apr 3, 2018
nbdsrv.h Drop the modern property May 17, 2018
netdb-compat.h Fix typo in include guard test Dec 27, 2012
treefiles.c Remove extraneous LOG_INFO option May 26, 2017
treefiles.h Fix race condition Jan 1, 2016

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

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 the following operating systems:

  • Debian (and derivatives, like Ubuntu): nbd-client and nbd-server, since Debian woody.
  • Gentoo: the nbd ebuild in the sys-block category, available in Portage since 2002.
  • FreeBSD: net/nbd-server, available in the ports tree since 2003. FreeBSD doesn't have kernel support for NBD, so obviously the client isn't built there.
  • SuSE: nbd, in SuSE 10.0
  • Fedora: nbd, since Fedora 7
  • uClibc's buildroot script also seems to have support for NBD.

If you're packaging NBD for a different operating system that isn't in the above list, I'd like to know about it.

For questions, please use the nbd-general@lists.sourceforge.net mailinglist.

Badges

Download Network Block Device Coverity Scan Build Status CII badge Travis

Packaging status