nbdkit (1)


NAME

nbdkit - A toolkit for creating NBD servers

SYNOPSIS

 nbdkit [-f] [-g GROUP] [-i IPADDR] [-P PIDFILE] [-p PORT]
        [-r] [-s] [-U SOCKET] [-u USER] [-v] [-V]
        PLUGIN.so [key=value [key=value [...]]]

DESCRIPTION

"nbdkit" is both a toolkit for creating Network Block Device (NBD) servers from ``unconventional'' sources and the name of an NBD server.

To create a new block device source, all you have to do is write a few glue functions. The liberal licensing of nbdkit is meant to allow you to link nbdkit with proprietary libraries or include nbdkit in proprietary code.

If you want to write an nbdkit plugin, you should read nbdkit-plugin(3).

Several plugins may be found in "LIBDIR/nbdkit/plugins" where "LIBDIR" is set at compile time and might be a path such as "/usr/lib", "/usr/lib64" or "/usr/local/lib".

EXAMPLES

Serve file "disk.img" on port 10809:

 nbdkit .../plugins/nbdkit-file-plugin.so file=disk.img

Run the example1 plugin and connect to it using guestfish(1):

 nbdkit .../plugins/nbdkit-example1-plugin.so
 guestfish --ro -a nbd://localhost

Run the example3 plugin and connect to it using guestfish(1):

 nbdkit .../plugins/nbdkit-example3-plugin.so size=1G
 guestfish --ro -a nbd://localhost

To display usage information about a specific plugin:

 nbdkit --help .../plugins/nbdkit-example1-plugin.so

GLOBAL OPTIONS

--help
Display brief command line usage information and exit.
-f
--foreground
--no-fork
Don't fork into the background.
-g GROUP
--group GROUP
Change group to "GROUP" after starting up. A group name or numeric group ID can be used.

The server needs sufficient permissions to be able to do this. Normally this would mean starting the server up as root.

See also -u.

-i IPADDR
--ip-addr IPADDR
--ipaddr IPADDR
Listen on the specified interface. The default is to listen on all interfaces. See also -p.
-P PIDFILE
--pid-file PIDFILE
--pidfile PIDFILE
Write "PIDFILE" (containing the process ID of the server) after nbdkit becomes ready to accept connections.

If the file already exists, it is overwritten. nbdkit does not delete the file when it exits.

-p PORT
--port PORT
Change the TCP/IP port number on which nbdkit serves requests. The default is 10809. See also -i.
-r
--read-only
--readonly
The export will be read-only. If a client writes, then it will get an error.

Note that some plugins inherently don't support writes. With those plugins the -r option is added implicitly.

Copy-on-write (or ``snapshot'') functionality is not supported by this server. However if you are using qemu as a client (or indirectly via libguestfs) then it supports snapshots.

-s
--single
--stdin
Don't fork. Handle a single NBD connection on stdin/stdout. After stdin closes, the server exits.

You can use this option to run nbdkit from inetd, systemd or similar superservers; or just for testing; or if you want to run nbdkit in a non-conventional way.

This option implies --foreground.

-U SOCKET
--unix SOCKET
Accept connections on the Unix domain socket "SOCKET" (which is a path).

nbdkit neither creates nor deletes this socket. You should create the socket and set the desired permissions and ownership before running the server.

-u USER
--user USER
Change user to "USER" after starting up. A user name or numeric user ID can be used.

The server needs sufficient permissions to be able to do this. Normally this would mean starting the server up as root.

See also -g.

-v
--verbose
Enable verbose messages.

It's a good idea to use -f as well so the process does not fork into the background (but not required).

-V
--version
Print the version number of nbdkit and exit.

PLUGIN CONFIGURATION

After specifying the plugin name you can (optionally, it depends on the plugin) give plugin configuration on the command line in the form of "key=value". For example:

 nbdkit .../plugins/nbdkit-file-plugin.so file=disk.img

To list all the options supported by a plugin, do:

 nbdkit --help .../plugins/nbdkit-file-plugin.so

SEE ALSO

nbdkit-plugin(3), nbdkit-example1-plugin(1), nbdkit-example2-plugin(1), nbdkit-example3-plugin(1), nbdkit-file-plugin(1), nbdkit-gzip-plugin(1), nbdkit-libvirt-plugin(1), nbdkit-vddk-plugin(1). nbdkit-xz-plugin(1).

AUTHORS

Richard W.M. Jones

COPYRIGHT

Copyright (C) 2013 Red Hat Inc.

LICENSE

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.