Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Tree [f7bf43] master nbd-3.10 /
History



File Date Author Commit
.travis 2014-03-20 Wouter Verhelst Wouter Verhelst [c6e5e3] Make the travis stuff work (after some testing ...
doc 2014-11-07 Wouter Verhelst Wouter Verhelst [2a9d1a] Add license statement
gznbd 2014-08-21 Andrey Mazo Andrey Mazo [f5bce2] gznbd: use atoll() to convert size argument
man 2015-03-17 Wouter Verhelst Wouter Verhelst [b7bfac] Update documentation of config file in light of...
tests 2015-03-08 Wouter Verhelst Wouter Verhelst [369401] Drop support for the oldstyle protocol
.gitignore 2013-12-18 Wouter Verhelst Wouter Verhelst [e1b460] Make a start with a library
.travis.yml 2014-09-18 Wouter Verhelst Wouter Verhelst [d05301] Revert "Enable automatic coverity coverage"
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 2014-10-02 Andrey Mazo Andrey Mazo [72d6ab] Wire gznbd into general configure.ac/Makefile.am
README.md 2014-10-15 Wouter Verhelst Wouter Verhelst [64d411] Modernize README, and point to sourceforge down...
autogen.sh 2011-05-28 Wouter Verhelst Wouter Verhelst [517b7a] Move nbd-trdump.8 to nbd-trdump.1, where it bel...
cliserv.c 2015-01-11 Wouter Verhelst Wouter Verhelst [e36a4d] Unbreak --enable-syslog
cliserv.h 2015-01-11 Wouter Verhelst Wouter Verhelst [e36a4d] Unbreak --enable-syslog
configure.ac 2015-03-17 Wouter Verhelst Wouter Verhelst [f7bf43] Don't forget configure.ac
coverity_model.c 2014-01-21 Wouter Verhelst Wouter Verhelst [53af7d] Create Coverity model
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 2015-03-17 Wouter Verhelst Wouter Verhelst [13870e] Groan
nbd-debug.h 2013-12-30 Wouter Verhelst Wouter Verhelst [232e0b] Move size_autodetect to library
nbd-server.c 2015-03-16 Wouter Verhelst Wouter Verhelst [e690f7] Fix NULL pointer dereference
nbd-trdump.c 2011-05-29 Wouter Verhelst Wouter Verhelst [53122e] Don't send to syslog from nbd-trdump
nbd.h 2011-09-08 Paolo Bonzini Paolo Bonzini [111058] add support for NBD_CMD_TRIM, update docs
nbdsrv.c 2014-10-01 Wouter Verhelst Wouter Verhelst [cd5175] Fix various warnings that pop up by default wit...
nbdsrv.h 2014-09-15 Wouter Verhelst Wouter Verhelst [fa01bd] Implement new config file option "cowdir"
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

Read Me

NBD README


Coverity Scan Build Status


build status

Welcome to the NBD userland support files!

This package contains nbd-server and nbd-client.

To install the package, 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.

Using NBD is quite easy. 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
    # Since version 2.9.17, nbd-server will do exports on a name
    # basis (the used name is the name of the section in which the
    # export is specified). This however required an incompatible
    # protocol change. To enable backwards-compatible port-based
    # exports, uncomment the following line:
    # oldstyle = true
[export1]
    exportname = /export/nbd/export1-file
    # The following line will be ignored unless the 
    # "oldstyle = true" line in the generic section above is
    # enabled.
    port = 12345
    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, except this one in case
    # the oldstyle option is used in [generic]:
    # port = 12346

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).

The old command-line port-only way of exporting something is still
supported, but it is deprecated.

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.