nbdkit [-f] [-g GROUP] [-i IPADDR] [-P PIDFILE] [-p PORT]
[-r] [-s] [-U SOCKET] [-u USER] [-v] [-V]
PLUGIN.so [key=value [key=value [...]]]
"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".
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
The server needs sufficient permissions to be able to do this. Normally this would mean starting the server up as root.
See also -u.
If the file already exists, it is overwritten. nbdkit does not delete the file when it exits.
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.
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.
nbdkit neither creates nor deletes this socket. You should create the socket and set the desired permissions and ownership before running the server.
The server needs sufficient permissions to be able to do this. Normally this would mean starting the server up as root.
See also -g.
It's a good idea to use -f as well so the process does not fork into the background (but not required).
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
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).
Richard W.M. Jones
Copyright (C) 2013 Red Hat Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
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.