.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "nbdkit 1" .TH nbdkit 1 "2014-10-14" "nbdkit" "nbdkit" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" nbdkit \- A toolkit for creating NBD servers .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& nbdkit [\-\-dump\-config] [\-f] [\-g GROUP] [\-i IPADDR] \& [\-P PIDFILE] [\-p PORT] [\-r] [\-\-run CMD] [\-s] \& [\-U SOCKET] [\-u USER] [\-v] [\-V] \& PLUGIN [key=value [key=value [...]]] .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`nbdkit\*(C'\fR is both a toolkit for creating Network Block Device (\s-1NBD\s0) servers from \*(L"unconventional\*(R" sources and the name of an \s-1NBD\s0 server. .PP 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. .PP If you want to write an nbdkit plugin, you should read \&\fInbdkit\-plugin\fR\|(3). .PP Several plugins may be found in \f(CW\*(C`$libdir/nbdkit/plugins\*(C'\fR. You can give the full path to the plugin, like this: .PP .Vb 1 \& nbdkit $libdir/nbdkit/plugins/nbdkit\-file\-plugin.so [...] .Ve .PP but it is usually more convenient to use this equivalent syntax: .PP .Vb 1 \& nbdkit file [...] .Ve .PP \&\f(CW$libdir\fR is set at compile time. To print it out, do: .PP .Vb 1 \& nbdkit \-\-dump\-config .Ve .SH "EXAMPLES" .IX Header "EXAMPLES" Serve file \f(CW\*(C`disk.img\*(C'\fR on port 10809: .PP .Vb 1 \& nbdkit file file=disk.img .Ve .PP Run the example1 plugin and connect to it using \fIguestfish\fR\|(1): .PP .Vb 2 \& nbdkit example1 \& guestfish \-\-ro \-a nbd://localhost .Ve .PP Run the example3 plugin and connect to it using \fIguestfish\fR\|(1): .PP .Vb 2 \& nbdkit example3 size=1G \& guestfish \-\-ro \-a nbd://localhost .Ve .PP To display usage information about a specific plugin: .PP .Vb 1 \& nbdkit \-\-help example1 .Ve .SH "GLOBAL OPTIONS" .IX Header "GLOBAL OPTIONS" .IP "\fB\-\-help\fR" 4 .IX Item "--help" Display brief command line usage information and exit. .IP "\fB\-\-dump\-config\fR" 4 .IX Item "--dump-config" Dump out the compile-time configuration values and exit. .IP "\fB\-f\fR" 4 .IX Item "-f" .PD 0 .IP "\fB\-\-foreground\fR" 4 .IX Item "--foreground" .IP "\fB\-\-no\-fork\fR" 4 .IX Item "--no-fork" .PD \&\fIDon't\fR fork into the background. .IP "\fB\-g\fR \s-1GROUP\s0" 4 .IX Item "-g GROUP" .PD 0 .IP "\fB\-\-group\fR \s-1GROUP\s0" 4 .IX Item "--group GROUP" .PD Change group to \f(CW\*(C`GROUP\*(C'\fR after starting up. A group name or numeric group \s-1ID\s0 can be used. .Sp The server needs sufficient permissions to be able to do this. Normally this would mean starting the server up as root. .Sp See also \fI\-u\fR. .IP "\fB\-i\fR \s-1IPADDR\s0" 4 .IX Item "-i IPADDR" .PD 0 .IP "\fB\-\-ip\-addr\fR \s-1IPADDR\s0" 4 .IX Item "--ip-addr IPADDR" .IP "\fB\-\-ipaddr\fR \s-1IPADDR\s0" 4 .IX Item "--ipaddr IPADDR" .PD Listen on the specified interface. The default is to listen on all interfaces. See also \fI\-p\fR. .IP "\fB\-P\fR \s-1PIDFILE\s0" 4 .IX Item "-P PIDFILE" .PD 0 .IP "\fB\-\-pid\-file\fR \s-1PIDFILE\s0" 4 .IX Item "--pid-file PIDFILE" .IP "\fB\-\-pidfile\fR \s-1PIDFILE\s0" 4 .IX Item "--pidfile PIDFILE" .PD Write \f(CW\*(C`PIDFILE\*(C'\fR (containing the process \s-1ID\s0 of the server) after nbdkit becomes ready to accept connections. .Sp If the file already exists, it is overwritten. nbdkit \fIdoes not\fR delete the file when it exits. .IP "\fB\-p\fR \s-1PORT\s0" 4 .IX Item "-p PORT" .PD 0 .IP "\fB\-\-port\fR \s-1PORT\s0" 4 .IX Item "--port PORT" .PD Change the \s-1TCP/IP\s0 port number on which nbdkit serves requests. The default is \f(CW10809\fR. See also \fI\-i\fR. .IP "\fB\-r\fR" 4 .IX Item "-r" .PD 0 .IP "\fB\-\-read\-only\fR" 4 .IX Item "--read-only" .IP "\fB\-\-readonly\fR" 4 .IX Item "--readonly" .PD The export will be read-only. If a client writes, then it will get an error. .Sp Note that some plugins inherently don't support writes. With those plugins the \fI\-r\fR option is added implicitly. .Sp Copy-on-write (or \*(L"snapshot\*(R") functionality is not supported by this server. However if you are using qemu as a client (or indirectly via libguestfs) then it supports snapshots. .IP "\fB\-\-run\fR \s-1CMD\s0" 4 .IX Item "--run CMD" Run nbdkit as a captive subprocess of \f(CW\*(C`CMD\*(C'\fR. When \f(CW\*(C`CMD\*(C'\fR exits, nbdkit is killed. See \*(L"\s-1CAPTIVE NBDKIT\*(R"\s0 below. .Sp This option implies \fI\-\-foreground\fR. .IP "\fB\-s\fR" 4 .IX Item "-s" .PD 0 .IP "\fB\-\-single\fR" 4 .IX Item "--single" .IP "\fB\-\-stdin\fR" 4 .IX Item "--stdin" .PD Don't fork. Handle a single \s-1NBD\s0 connection on stdin/stdout. After stdin closes, the server exits. .Sp 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. .Sp This option implies \fI\-\-foreground\fR. .IP "\fB\-U\fR \s-1SOCKET\s0" 4 .IX Item "-U SOCKET" .PD 0 .IP "\fB\-\-unix\fR \s-1SOCKET\s0" 4 .IX Item "--unix SOCKET" .IP "\fB\-U \-\fR" 4 .IX Item "-U -" .IP "\fB\-\-unix \-\fR" 4 .IX Item "--unix -" .PD Accept connections on the Unix domain socket \f(CW\*(C`SOCKET\*(C'\fR (which is a path). .Sp nbdkit creates this socket, but it will probably have incorrect permissions (too permissive). If it is a problem that some unauthorized user could connect to this socket between the time that nbdkit starts up and the authorized user connects, then put the socket into a directory that has restrictive permissions. .Sp nbdkit does \fBnot\fR delete the socket file when it exits. The caller should delete the socket file after use (else if you try to start nbdkit up again you will get an \f(CW\*(C`Address already in use\*(C'\fR error). .Sp If the socket name is \fI\-\fR then nbdkit generates a randomly named private socket. This is useful with \*(L"\s-1CAPTIVE NBDKIT\*(R"\s0. .IP "\fB\-u\fR \s-1USER\s0" 4 .IX Item "-u USER" .PD 0 .IP "\fB\-\-user\fR \s-1USER\s0" 4 .IX Item "--user USER" .PD Change user to \f(CW\*(C`USER\*(C'\fR after starting up. A user name or numeric user \&\s-1ID\s0 can be used. .Sp The server needs sufficient permissions to be able to do this. Normally this would mean starting the server up as root. .Sp See also \fI\-g\fR. .IP "\fB\-v\fR" 4 .IX Item "-v" .PD 0 .IP "\fB\-\-verbose\fR" 4 .IX Item "--verbose" .PD Enable verbose messages. .Sp It's a good idea to use \fI\-f\fR as well so the process does not fork into the background (but not required). .IP "\fB\-V\fR" 4 .IX Item "-V" .PD 0 .IP "\fB\-\-version\fR" 4 .IX Item "--version" .PD Print the version number of nbdkit and exit. .SH "PLUGIN CONFIGURATION" .IX Header "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 \f(CW\*(C`key=value\*(C'\fR. For example: .PP .Vb 1 \& nbdkit file file=disk.img .Ve .PP To list all the options supported by a plugin, do: .PP .Vb 1 \& nbdkit \-\-help file .Ve .SH "CAPTIVE NBDKIT" .IX Header "CAPTIVE NBDKIT" You can run nbdkit as a \*(L"captive process\*(R", using the \fI\-\-run\fR option. This means that nbdkit runs as long as (for example) \fIqemu\fR\|(1) or \&\fIguestfish\fR\|(1) is running. When those exit, nbdkit is killed. .PP Some examples should make this clear. .PP To run nbdkit captive under qemu: .PP .Vb 1 \& nbdkit file file=disk.img \-\-run \*(Aqqemu \-drive file=$nbd,if=virtio\*(Aq .Ve .PP On the qemu command line, \f(CW$nbd\fR is substituted automatically with the right \s-1NBD\s0 path so it can connect to nbdkit. When qemu exits, nbdkit is killed and cleaned up automatically. .PP Running nbdkit captive under guestfish: .PP .Vb 1 \& nbdkit file file=disk.img \-\-run \*(Aqguestfish \-\-format=raw \-a $nbd \-i\*(Aq .Ve .PP When guestfish exits, nbdkit is killed. .PP The following shell variables are available in the \fI\-\-run\fR argument: .ie n .IP "$nbd" 4 .el .IP "\f(CW$nbd\fR" 4 .IX Item "$nbd" A \s-1URL\s0 that refers to the nbdkit port or socket. .Sp Note there is some magic here, since qemu and guestfish URLs have a different format, so nbdkit tries to guess which you are running. If the magic doesn't work, try using the variables below instead. .ie n .IP "$port" 4 .el .IP "\f(CW$port\fR" 4 .IX Item "$port" If ≠ "", the port number that nbdkit is listening on. .ie n .IP "$unixsocket" 4 .el .IP "\f(CW$unixsocket\fR" 4 .IX Item "$unixsocket" If ≠ "", the Unix domain socket that nbdkit is listening on. .PP \&\fI\-\-run\fR implies \fI\-\-foreground\fR. It is not possible, and probably not desirable, to have nbdkit fork into the background when using \&\fI\-\-run\fR. .PP Even when running captive, nbdkit still listens on the regular \s-1TCP/IP\s0 port, unless you specify the \fI\-p\fR/\fI\-U\fR options. If you want a truly private captive nbdkit, then you should create a private random Unix socket, like this: .PP .Vb 1 \& nbdkit \-U \- plugin [args] \-\-run \*(Aq...\*(Aq .Ve .SH "SIGNALS" .IX Header "SIGNALS" \&\f(CW\*(C`nbdkit\*(C'\fR responds to the following signals: .ie n .IP """SIGINT""" 4 .el .IP "\f(CWSIGINT\fR" 4 .IX Item "SIGINT" .PD 0 .ie n .IP """SIGQUIT""" 4 .el .IP "\f(CWSIGQUIT\fR" 4 .IX Item "SIGQUIT" .ie n .IP """SIGTERM""" 4 .el .IP "\f(CWSIGTERM\fR" 4 .IX Item "SIGTERM" .PD The server exits cleanly. .ie n .IP """SIGPIPE""" 4 .el .IP "\f(CWSIGPIPE\fR" 4 .IX Item "SIGPIPE" This signal is ignored. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fInbdkit\-plugin\fR\|(3), \&\fInbdkit\-curl\-plugin\fR\|(1), \&\fInbdkit\-example1\-plugin\fR\|(1), \&\fInbdkit\-example2\-plugin\fR\|(1), \&\fInbdkit\-example3\-plugin\fR\|(1), \&\fInbdkit\-file\-plugin\fR\|(1), \&\fInbdkit\-gzip\-plugin\fR\|(1), \&\fInbdkit\-libvirt\-plugin\fR\|(1), \&\fInbdkit\-perl\-plugin\fR\|(3), \&\fInbdkit\-python\-plugin\fR\|(3), \&\fInbdkit\-vddk\-plugin\fR\|(1). \&\fInbdkit\-xz\-plugin\fR\|(1). .SH "AUTHORS" .IX Header "AUTHORS" Richard W.M. Jones .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2013 Red Hat Inc. .SH "LICENSE" .IX Header "LICENSE" Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: .IP "\(bu" 4 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. .IP "\(bu" 4 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. .IP "\(bu" 4 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. .PP \&\s-1THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS \s0''\s-1AS IS\s0'' \s-1AND 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 \s0(\s-1INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES\s0; \s-1LOSS OF USE, DATA, OR PROFITS\s0; \s-1OR BUSINESS INTERRUPTION\s0) \s-1HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \s0(\s-1INCLUDING NEGLIGENCE OR OTHERWISE\s0) \s-1ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\s0