Skip to content

krisman/nbd

This branch is 123 commits behind NetworkBlockDevice/nbd:master.

Folders and files

NameName
Last commit message
Last commit date
Mar 7, 2022
Apr 1, 2022
Oct 2, 2014
Mar 3, 2022
Oct 10, 2015
Jan 17, 2021
Mar 7, 2022
Oct 20, 2016
Mar 7, 2022
May 1, 2019
Dec 2, 2013
Aug 5, 2006
Mar 7, 2022
Oct 5, 2020
Mar 3, 2022
Nov 7, 2015
Feb 21, 2017
Nov 3, 2016
Sep 7, 2018
Apr 11, 2019
Mar 7, 2022
Jan 21, 2014
Feb 21, 2017
Nov 3, 2016
Dec 6, 2011
May 28, 2011
May 21, 2011
Oct 18, 2021
Apr 11, 2016
Mar 3, 2022
Sep 14, 2017
Mar 6, 2022
Mar 3, 2022
Mar 3, 2022
Mar 3, 2022
Jul 30, 2021
Feb 24, 2021
Mar 3, 2022
Jan 13, 2022
Jul 30, 2021
Dec 27, 2012
May 26, 2017
Jan 1, 2016

Repository files navigation

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 most current operating systems; see the "Packaging status" badge below for details.

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

Badges

Download Network Block Device Coverity Scan Build Status CII badge Travis

Packaging status

Packages

No packages published

Languages

  • C 90.9%
  • M4 3.8%
  • Shell 3.4%
  • Makefile 1.6%
  • Yacc 0.2%
  • Lex 0.1%