5 nbdkit - A toolkit for creating NBD servers
9 nbdkit [--dump-config] [-f] [-g GROUP] [-i IPADDR]
10 [-P PIDFILE] [-p PORT] [-r] [-s]
11 [-U SOCKET] [-u USER] [-v] [-V]
12 PLUGIN [key=value [key=value [...]]]
16 C<nbdkit> is both a toolkit for creating Network Block Device (NBD)
17 servers from "unconventional" sources and the name of an NBD server.
19 To create a new block device source, all you have to do is write a few
20 glue functions. The liberal licensing of nbdkit is meant to allow you
21 to link nbdkit with proprietary libraries or include nbdkit in
24 If you want to write an nbdkit plugin, you should read
27 Several plugins may be found in C<$libdir/nbdkit/plugins>. You can
28 give the full path to the plugin, like this:
30 nbdkit $libdir/nbdkit/plugins/nbdkit-file-plugin.so [...]
32 but it is usually more convenient to use this equivalent syntax:
36 C<$libdir> is set at compile time. To print it out, do:
42 Serve file C<disk.img> on port 10809:
44 nbdkit file file=disk.img
46 Run the example1 plugin and connect to it using L<guestfish(1)>:
49 guestfish --ro -a nbd://localhost
51 Run the example3 plugin and connect to it using L<guestfish(1)>:
53 nbdkit example3 size=1G
54 guestfish --ro -a nbd://localhost
56 To display usage information about a specific plugin:
58 nbdkit --help example1
66 Display brief command line usage information and exit.
68 =item B<--dump-config>
70 Dump out the compile-time configuration values and exit.
78 I<Don't> fork into the background.
82 =item B<--group> GROUP
84 Change group to C<GROUP> after starting up. A group name or numeric
87 The server needs sufficient permissions to be able to do this.
88 Normally this would mean starting the server up as root.
94 =item B<--ip-addr> IPADDR
96 =item B<--ipaddr> IPADDR
98 Listen on the specified interface. The default is to listen on all
99 interfaces. See also I<-p>.
103 =item B<--pid-file> PIDFILE
105 =item B<--pidfile> PIDFILE
107 Write C<PIDFILE> (containing the process ID of the server) after
108 nbdkit becomes ready to accept connections.
110 If the file already exists, it is overwritten. nbdkit I<does not>
111 delete the file when it exits.
117 Change the TCP/IP port number on which nbdkit serves requests.
118 The default is C<10809>. See also I<-i>.
126 The export will be read-only. If a client writes, then it will get an
129 Note that some plugins inherently don't support writes. With those
130 plugins the I<-r> option is added implicitly.
132 Copy-on-write (or "snapshot") functionality is not supported by this
133 server. However if you are using qemu as a client (or indirectly via
134 libguestfs) then it supports snapshots.
142 Don't fork. Handle a single NBD connection on stdin/stdout. After
143 stdin closes, the server exits.
145 You can use this option to run nbdkit from inetd, systemd or similar
146 superservers; or just for testing; or if you want to run nbdkit in a
147 non-conventional way.
149 This option implies I<--foreground>.
153 =item B<--unix> SOCKET
155 Accept connections on the Unix domain socket C<SOCKET> (which is a
158 nbdkit creates this socket, but it will probably have incorrect
159 permissions (too permissive). If it is a problem that some
160 unauthorized user could connect to this socket between the time that
161 nbdkit starts up and the authorized user connects, then put the socket
162 into a directory that has restrictive permissions.
164 nbdkit does B<not> delete the socket file when it exits. The caller
165 should delete the socket file after use (else if you try to start
166 nbdkit up again you will get an C<Address already in use> error).
172 Change user to C<USER> after starting up. A user name or numeric user
175 The server needs sufficient permissions to be able to do this.
176 Normally this would mean starting the server up as root.
184 Enable verbose messages.
186 It's a good idea to use I<-f> as well so the process does not fork
187 into the background (but not required).
193 Print the version number of nbdkit and exit.
197 =head1 PLUGIN CONFIGURATION
199 After specifying the plugin name you can (optionally, it depends
200 on the plugin) give plugin configuration on the command line in
201 the form of C<key=value>. For example:
203 nbdkit file file=disk.img
205 To list all the options supported by a plugin, do:
212 L<nbdkit-example1-plugin(1)>,
213 L<nbdkit-example2-plugin(1)>,
214 L<nbdkit-example3-plugin(1)>,
215 L<nbdkit-file-plugin(1)>,
216 L<nbdkit-gzip-plugin(1)>,
217 L<nbdkit-libvirt-plugin(1)>,
218 L<nbdkit-perl-plugin(3)>,
219 L<nbdkit-python-plugin(3)>,
220 L<nbdkit-vddk-plugin(1)>.
221 L<nbdkit-xz-plugin(1)>.
229 Copyright (C) 2013 Red Hat Inc.
233 Redistribution and use in source and binary forms, with or without
234 modification, are permitted provided that the following conditions are
241 Redistributions of source code must retain the above copyright
242 notice, this list of conditions and the following disclaimer.
246 Redistributions in binary form must reproduce the above copyright
247 notice, this list of conditions and the following disclaimer in the
248 documentation and/or other materials provided with the distribution.
252 Neither the name of Red Hat nor the names of its contributors may be
253 used to endorse or promote products derived from this software without
254 specific prior written permission.
258 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
259 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
260 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
261 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
262 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
263 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
264 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
265 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
266 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
267 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
268 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF