.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Podwrapper::Man 1.36.3 (Pod::Simple 3.43) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 >0, 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 2024-01-17 nbdkit-1.36.3 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 \- toolkit for creating Network Block Device (NBD) servers .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 10 \& nbdkit [\-4|\-\-ipv4\-only] [\-6|\-\-ipv6\-only] \& [\-D|\-\-debug PLUGIN|FILTER|nbdkit.FLAG=N] \& [\-\-exit\-with\-parent] [\-e|\-\-exportname EXPORTNAME] \& [\-\-filter=FILTER ...] [\-f|\-\-foreground] \& [\-g|\-\-group GROUP] [\-i|\-\-ipaddr IPADDR] \& [\-\-log=stderr|syslog|null] [\-\-mask\-handshake=MASK] \& [\-n|\-\-newstyle] [\-\-no\-sr] [\-o|\-\-oldstyle] \& [\-P|\-\-pidfile PIDFILE] [\-p|\-\-port PORT] \& [\-r|\-\-readonly] [\-\-run \*(AqCOMMAND ARGS ...\*(Aq] \& [\-\-selinux\-label=LABEL] [\-s|\-\-single] [\-\-swap] \& [\-t|\-\-threads THREADS] [\-\-tls=off|on|require] \& [\-\-tls\-certificates=/path/to/certificates] \& [\-\-tls\-psk=/path/to/pskfile] [\-\-tls\-verify\-peer] \& [\-U|\-\-unix SOCKET|\-] [\-u|\-\-user USER] \& [\-v|\-\-verbose] [\-\-vsock] \& PLUGIN [[KEY=]VALUE [KEY=VALUE [...]]] \& \& nbdkit \-\-dump\-config \& \& nbdkit PLUGIN \-\-dump\-plugin \& \& nbdkit \-\-help \& \& nbdkit [\-V|\-\-version] .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Network Block Device (NBD) is a network protocol for accessing block devices over the network. Block devices are hard disks and things that behave like hard disks such as disk images and virtual machines. .PP nbdkit is both a toolkit for creating NBD servers from “unconventional” sources, and the name of an NBD server. nbdkit ships with many plugins for performing common tasks like serving local files. .SS "Plugins and filters" .IX Subsection "Plugins and filters" nbdkit is different from other NBD servers because you can easily create new Network Block Device sources by writing a few glue functions, possibly in C, or perhaps in a high level language like Perl or Python. The liberal licensing of nbdkit is meant to allow you to link nbdkit with proprietary libraries or to include nbdkit in proprietary code. .PP If you want to write your own nbdkit plugin you should read \&\fBnbdkit\-plugin\fR\|(3). .PP nbdkit also has a concept of filters which can be layered on top of plugins. Several filters are provided with nbdkit and if you want to write your own you should read \fBnbdkit\-filter\fR\|(3). .SH EXAMPLES .IX Header "EXAMPLES" .SS "Basic file serving" .IX Subsection "Basic file serving" .IP \(bu 4 Serve file \fIdisk.img\fR on port 10809 using \fBnbdkit\-file\-plugin\fR\|(1), and connect to it using \fBguestfish\fR\|(1): .Sp .Vb 2 \& nbdkit file disk.img \& guestfish \-\-rw \-\-format=raw \-a nbd://localhost .Ve .IP \(bu 4 Serve file \fIdisk.img\fR on port 10809, requiring clients to use encrypted (TLS) connections: .Sp .Vb 1 \& nbdkit \-\-tls=require file disk.img .Ve .SS "Other nbdkit plugins" .IX Subsection "Other nbdkit plugins" .IP \(bu 4 Create a small disk containing test patterns using \&\fBnbdkit\-data\-plugin\fR\|(1): .Sp .Vb 1 \& nbdkit data \*(Aq ( 0x55 0xAA )*2048 \*(Aq .Ve .IP \(bu 4 Forward an NBD connection to a remote server over HTTPS or SSH using \&\fBnbdkit\-curl\-plugin\fR\|(1) or \fBnbdkit\-ssh\-plugin\fR\|(1): .Sp .Vb 1 \& nbdkit \-r curl https://example.com/disk.img .Ve .Sp .Vb 1 \& nbdkit ssh host=example.com /var/tmp/disk.img .Ve .IP \(bu 4 Create a sparse 1 terabyte RAM disk using \fBnbdkit\-memory\-plugin\fR\|(1) and use it as a loop device (\fBnbdkit\-loop\fR\|(1)): .Sp .Vb 2 \& nbdkit memory 1T \& nbd\-client localhost /dev/nbd0 .Ve .IP \(bu 4 Create a floppy disk image containing files from a local directory using \fBnbdkit\-floppy\-plugin\fR\|(1): .Sp .Vb 1 \& nbdkit floppy dir/ .Ve .SS "Combining plugins and filters" .IX Subsection "Combining plugins and filters" .IP \(bu 4 Serve only the first partition from compressed disk image \&\fIdisk.img.xz\fR, combining \fBnbdkit\-partition\-filter\fR\|(1), \&\fBnbdkit\-xz\-filter\fR\|(1) and \fBnbdkit\-file\-plugin\fR\|(1). .Sp .Vb 1 \& nbdkit \-\-filter=partition \-\-filter=xz file disk.img.xz partition=1 .Ve .Sp To understand this command line: .Sp .Vb 9 \& plugin name and plugin parameter \& │ \& ┌───────┴──────┐ \& │ │ \& nbdkit \-\-filter=partition \-\-filter=xz file disk.img.xz partition=1 \& │ │ │ \& └──────────────┴────┬─────────────────────┘ \& │ \& filters and filter parameter .Ve .IP \(bu 4 Create a scratch, empty nbdkit device and inject errors and delays, for testing clients, using \fBnbdkit\-memory\-plugin\fR\|(1), \&\fBnbdkit\-error\-filter\fR\|(1) and \fBnbdkit\-delay\-filter\fR\|(1): .Sp .Vb 2 \& nbdkit \-\-filter=error \-\-filter=delay memory 100M \e \& error\-rate=10% rdelay=1 wdelay=1 .Ve .SS "Writing plugins in shell script" .IX Subsection "Writing plugins in shell script" .IP \(bu 4 Write a simple, custom plugin in shell script using \&\fBnbdkit\-sh\-plugin\fR\|(3): .Sp .Vb 7 \& nbdkit sh \- <<\*(AqEOF\*(Aq \& case "$1" in \& get_size) echo 1M ;; \& pread) dd if=/dev/zero count=$3 iflag=count_bytes ;; \& *) exit 2 ;; \& esac \& EOF .Ve .IP \(bu 4 The same example as above can be written entirely on the command line using \fBnbdkit\-eval\-plugin\fR\|(1): .Sp .Vb 2 \& nbdkit eval get_size=\*(Aqecho 1M\*(Aq \e \& pread=\*(Aqdd if=/dev/zero count=$3 iflag=count_bytes\*(Aq .Ve .SS "Display information" .IX Subsection "Display information" Display information about nbdkit or a specific plugin: .PP .Vb 5 \& nbdkit \-\-help \& nbdkit \-\-version \& nbdkit \-\-dump\-config \& nbdkit example1 \-\-help \& nbdkit example1 \-\-dump\-plugin .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\-4\fR 4 .IX Item "-4" .PD 0 .IP \fB\-\-ipv4\-only\fR 4 .IX Item "--ipv4-only" .IP \fB\-6\fR 4 .IX Item "-6" .IP \fB\-\-ipv6\-only\fR 4 .IX Item "--ipv6-only" .PD When a non-numeric argument is passed to the \fI\-i\fR option (such as a Fully Qualified Domain Name, or a host name from \f(CW\*(C`/etc/hosts\*(C'\fR), restrict the name resolution to IPv4 or IPv6 addresses. .Sp When the \fI\-i\fR option is omitted, listen on only the IPv4 or IPv6 address of all interfaces (\f(CW0.0.0.0\fR or \f(CW\*(C`::\*(C'\fR, respectively). .Sp When both \fI\-4\fR and \fI\-6\fR options are present on the command line, the last one takes effect. .IP "\fB\-D\fR PLUGIN.FLAG=N" 4 .IX Item "-D PLUGIN.FLAG=N" .PD 0 .IP "\fB\-D\fR FILTER.FLAG=N" 4 .IX Item "-D FILTER.FLAG=N" .IP "\fB\-\-debug\fR PLUGIN.FLAG=N" 4 .IX Item "--debug PLUGIN.FLAG=N" .IP "\fB\-\-debug\fR FILTER.FLAG=N" 4 .IX Item "--debug FILTER.FLAG=N" .PD Set the plugin or filter Debug Flag called \f(CW\*(C`FLAG\*(C'\fR to the integer value \f(CW\*(C`N\*(C'\fR. See "Debug Flags" in \fBnbdkit\-plugin\fR\|(3). .IP "\fB\-D\fR nbdkit.FLAG=N" 4 .IX Item "-D nbdkit.FLAG=N" .PD 0 .IP "\fB\-\-debug\fR nbdkit.FLAG=N" 4 .IX Item "--debug nbdkit.FLAG=N" .PD (nbdkit ≥ 1.18) .Sp Set the nbdkit server Debug Flag called \f(CW\*(C`FLAG\*(C'\fR to the integer value \&\f(CW\*(C`N\*(C'\fR. See "SERVER DEBUG FLAGS" below. .IP \fB\-\-dump\-config\fR 4 .IX Item "--dump-config" Dump out the compile-time configuration values and exit. See \fBnbdkit\-probing\fR\|(1). .IP \fB\-\-dump\-plugin\fR 4 .IX Item "--dump-plugin" Dump out information about the plugin and exit. See \fBnbdkit\-probing\fR\|(1). .IP \fB\-\-exit\-with\-parent\fR 4 .IX Item "--exit-with-parent" If the parent process exits, we exit. This can be used to avoid complicated cleanup or orphaned nbdkit processes. There are some important caveats with this, see "EXIT WITH PARENT" in \fBnbdkit\-captive\fR\|(1). .Sp An alternative to this is "CAPTIVE NBDKIT" in \fBnbdkit\-captive\fR\|(1). .Sp This option implies \fI\-\-foreground\fR. .IP "\fB\-e\fR EXPORTNAME" 4 .IX Item "-e EXPORTNAME" .PD 0 .IP \fB\-\-export=\fREXPORTNAME 4 .IX Item "--export=EXPORTNAME" .IP \fB\-\-export\-name=\fREXPORTNAME 4 .IX Item "--export-name=EXPORTNAME" .IP \fB\-\-exportname=\fREXPORTNAME 4 .IX Item "--exportname=EXPORTNAME" .PD Set a preferred exportname to expose in the shell environment created during \fI\-\-run\fR. The use of this option without \fI\-\-run\fR has no effect. This option does \fInot\fR change what nbdkit advertises as a server, but can aid in writing a captive client that wants to access particular content from a plugin that differentiates content based on the client's choice of export name. .Sp If not set, the \fI\-\-run\fR environment is set to access the default exportname \f(CW""\fR (empty string). .IP \fB\-\-filter=\fRFILTER 4 .IX Item "--filter=FILTER" Add a filter before the plugin. This option may be given one or more times to stack filters in front of the plugin. They are processed in the order they appear on the command line. See "FILTERS" and \&\fBnbdkit\-filter\fR\|(3). .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 GROUP" 4 .IX Item "-g GROUP" .PD 0 .IP \fB\-\-group=\fRGROUP 4 .IX Item "--group=GROUP" .PD Change group to \f(CW\*(C`GROUP\*(C'\fR after starting up. A group name or numeric group ID 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 IPADDR" 4 .IX Item "-i IPADDR" .PD 0 .IP \fB\-\-ip\-addr=\fRIPADDR 4 .IX Item "--ip-addr=IPADDR" .IP \fB\-\-ipaddr=\fRIPADDR 4 .IX Item "--ipaddr=IPADDR" .PD Listen on the specified interface. The default is to listen on all interfaces. See also \fI\-4\fR, \fI\-6\fR, and \fI\-p\fR. .IP \fB\-\-log=stderr\fR 4 .IX Item "--log=stderr" .PD 0 .IP \fB\-\-log=syslog\fR 4 .IX Item "--log=syslog" .IP \fB\-\-log=null\fR 4 .IX Item "--log=null" .PD Send error messages to standard error (\fI\-\-log=stderr\fR), or to the system log (\fI\-\-log=syslog\fR), or discard them completely (\fI\-\-log=null\fR, not recommended for normal use). .Sp The default is to send error messages to stderr, unless nbdkit forks into the background in which case they are sent to syslog. .Sp For more details see "LOGGING" in \fBnbdkit\-service\fR\|(1). .IP \fB\-\-mask\-handshake=\fRMASK 4 .IX Item "--mask-handshake=MASK" This option can be used to mask off particular global features which are advertised during new-style handshake (defaulting to all supported bits set). See \fBnbdkit\-protocol\fR\|(1). .IP \fB\-n\fR 4 .IX Item "-n" .PD 0 .IP \fB\-\-new\-style\fR 4 .IX Item "--new-style" .IP \fB\-\-newstyle\fR 4 .IX Item "--newstyle" .PD Use the newstyle NBD protocol. This is the default in nbdkit ≥ 1.3. In earlier versions the default was oldstyle. See \fBnbdkit\-protocol\fR\|(1). .IP \fB\-\-no\-sr\fR 4 .IX Item "--no-sr" Do not advertise structured replies. A client must request structured replies to take advantage of block status and potential sparse reads; however, as structured reads are not a mandatory part of the newstyle NBD protocol, this option can be used to debug client fallbacks for dealing with older servers. See \fBnbdkit\-protocol\fR\|(1). .IP \fB\-o\fR 4 .IX Item "-o" .PD 0 .IP \fB\-\-old\-style\fR 4 .IX Item "--old-style" .IP \fB\-\-oldstyle\fR 4 .IX Item "--oldstyle" .PD Use the oldstyle NBD protocol. This \fIwas\fR the default in nbdkit ≤ 1.2, but now the default is newstyle. Note this is incompatible with newer features such as export names and TLS. See \fBnbdkit\-protocol\fR\|(1). .IP "\fB\-P\fR PIDFILE" 4 .IX Item "-P PIDFILE" .PD 0 .IP \fB\-\-pid\-file=\fRPIDFILE 4 .IX Item "--pid-file=PIDFILE" .IP \fB\-\-pidfile=\fRPIDFILE 4 .IX Item "--pidfile=PIDFILE" .PD Write \f(CW\*(C`PIDFILE\*(C'\fR (containing the process ID 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 PORT" 4 .IX Item "-p PORT" .PD 0 .IP \fB\-\-port=\fRPORT 4 .IX Item "--port=PORT" .PD Change the TCP/IP 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 \&\fBnbdkit\-cow\-filter\fR\|(1) can be placed over read-only plugins to provide copy-on-write (or "snapshot") functionality. If you are using qemu as a client then it also supports snapshots. .IP "\fB\-\-run\fR 'COMMAND ARGS ...'" 4 .IX Item "--run 'COMMAND ARGS ...'" Run nbdkit as a captive subprocess of the command. When the command exits, nbdkit is killed. See "CAPTIVE NBDKIT" in \fBnbdkit\-captive\fR\|(1). .Sp Note that the command is executed by \fI/bin/sh\fR. On some platforms like Debian this might not be a full-featured shell. .Sp This option implies \fI\-\-foreground\fR. .Sp In nbdkit ≤ 1.34 you normally had to add \fI\-U \-\fR, otherwise nbdkit would use a TCP/IP port which was not what you wanted. In nbdkit ≥ 1.36, using \fI\-\-run\fR implies \fI\-U \-\fR. If you want the old behaviour of nbdkit then you must use the \fI\-\-port\fR option explicitly. .IP \fB\-\-selinux\-label=\fRSOCKET-LABEL 4 .IX Item "--selinux-label=SOCKET-LABEL" Apply the SELinux label \f(CW\*(C`SOCKET\-LABEL\*(C'\fR to the nbdkit listening socket. .Sp The common — perhaps only — use of this option is to allow libvirt guests which are using SELinux and sVirt confinement to access nbdkit Unix domain sockets. The example below shows how to do this. Note that the socket and filesystem labels are different. .Sp .Vb 2 \& nbdkit \-U /tmp/sock \-\-selinux\-label=system_u:object_r:svirt_socket_t:s0 ... \& chcon system_u:object_r:svirt_image_t:s0 /tmp/sock .Ve .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 NBD connection on stdin/stdout. After stdin closes, the server exits. .Sp You can use this option to run nbdkit from inetd or similar superservers; or just for testing; or if you want to run nbdkit in a non-conventional way. Note that if you want to run nbdkit from systemd, then it may be better to use "SOCKET ACTIVATION" in \fBnbdkit\-service\fR\|(1) instead of this option. .Sp This option implies \fI\-\-foreground\fR. .IP \fB\-\-swap\fR 4 .IX Item "--swap" (nbdkit ≥ 1.18) .Sp Specifies that the NBD device will be used as swap space loop mounted on the same machine which is running nbdkit. To avoid deadlocks this locks the whole nbdkit process into memory using \fBmlockall\fR\|(2). This may require additional permissions, such as starting the server as root or raising the \f(CW\*(C`RLIMIT_MEMLOCK\*(C'\fR (\fBulimit\fR\|(1) \fI\-l\fR) limit on the process. .IP "\fB\-t\fR THREADS" 4 .IX Item "-t THREADS" .PD 0 .IP \fB\-\-threads=\fRTHREADS 4 .IX Item "--threads=THREADS" .PD Set the number of threads to be used per connection, which in turn controls the number of outstanding requests that can be processed at once. Only matters for plugins with thread_model=parallel (where it defaults to 16). To force serialized behavior (useful if the client is not prepared for out-of-order responses), set this to 1. .IP \fB\-\-tls=off\fR 4 .IX Item "--tls=off" .PD 0 .IP \fB\-\-tls=on\fR 4 .IX Item "--tls=on" .IP \fB\-\-tls=require\fR 4 .IX Item "--tls=require" .PD Disable, enable or require TLS (authentication and encryption support). See \fBnbdkit\-tls\fR\|(1). .IP \fB\-\-tls\-certificates=\fR/path/to/certificates 4 .IX Item "--tls-certificates=/path/to/certificates" Set the path to the TLS certificates directory. If not specified, some built-in paths are checked. See \fBnbdkit\-tls\fR\|(1) for more details. .IP \fB\-\-tls\-psk=\fR/path/to/pskfile 4 .IX Item "--tls-psk=/path/to/pskfile" Set the path to the pre-shared keys (PSK) file. If used, this overrides certificate authentication. There is no built-in path. See \&\fBnbdkit\-tls\fR\|(1) for more details. .IP \fB\-\-tls\-verify\-peer\fR 4 .IX Item "--tls-verify-peer" Enables TLS client certificate verification. The default is \fInot\fR to check the client's certificate. .IP "\fB\-U\fR SOCKET" 4 .IX Item "-U SOCKET" .PD 0 .IP \fB\-\-unix=\fRSOCKET 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 implied by the \fI\-\-run\fR option. See also "CAPTIVE NBDKIT" in \fBnbdkit\-captive\fR\|(1). .IP "\fB\-u\fR USER" 4 .IX Item "-u USER" .PD 0 .IP \fB\-\-user=\fRUSER 4 .IX Item "--user=USER" .PD Change user to \f(CW\*(C`USER\*(C'\fR after starting up. A user name or numeric user ID 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. .Sp The \fI\-\-dump\-config\fR option provides separate major and minor numbers and may be easier to parse from shell scripts. .IP \fB\-\-vsock\fR 4 .IX Item "--vsock" (nbdkit ≥ 1.16) .Sp Use the AF_VSOCK protocol (instead of TCP/IP). You must use this in conjunction with \fI\-p\fR/\fI\-\-port\fR. See "AF_VSOCK" in \fBnbdkit\-service\fR\|(1). .SH "PLUGIN NAME" .IX Header "PLUGIN NAME" 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 "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 .PP To dump information about a plugin, do: .PP .Vb 1 \& nbdkit file \-\-dump\-plugin .Ve .SS "Magic parameters" .IX Subsection "Magic parameters" Some plugins declare a special "magic config key". This is a key which is assumed if no \f(CW\*(C`key=\*(C'\fR part is present. For example: .PP .Vb 1 \& nbdkit file disk.img .Ve .PP is assumed to be \f(CW\*(C`file=disk.img\*(C'\fR because the file plugin declares \&\f(CW\*(C`file\*(C'\fR as its magic config key. There can be ambiguity in the parsing of magic config keys if the value might look like a \&\f(CW\*(C`key=value\*(C'\fR. If there could be ambiguity then modify the value, eg. by prefixing it with \f(CW\*(C`./\*(C'\fR .PP There is also a special exception for plugins which do not declare a magic config key, but where the first plugin argument does not contain an \f(CW\*(Aq=\*(Aq\fR character: it is assumed to be \f(CW\*(C`script=value\*(C'\fR. This is used by scripting language plugins: .PP .Vb 1 \& nbdkit perl foo.pl [args...] .Ve .PP has the same meaning as: .PP .Vb 1 \& nbdkit perl script=foo.pl [args...] .Ve .SS "Shebang scripts" .IX Subsection "Shebang scripts" You can use \f(CW\*(C`#!\*(C'\fR to run nbdkit plugins written in most scripting languages. The file should be executable. For example: .PP .Vb 4 \& #!/usr/sbin/nbdkit perl \& sub open { \& # etc \& } .Ve .PP (see \fBnbdkit\-perl\-plugin\fR\|(3) for a full example). .SH "SERVER DEBUG FLAGS" .IX Header "SERVER DEBUG FLAGS" As well as enabling or disabling debugging in the server using \&\fI\-\-verbose\fR you can control extra debugging in the server using the \&\fI\-D\ nbdkit.*\fR flags listed in this section. Note these flags are an internal implementation detail of the server and may be changed or removed at any time in the future. .IP "\fB\-D nbdkit.backend.controlpath=0\fR" 4 .IX Item "-D nbdkit.backend.controlpath=0" .PD 0 .IP "\fB\-D nbdkit.backend.controlpath=1\fR" 4 .IX Item "-D nbdkit.backend.controlpath=1" .IP "\fB\-D nbdkit.backend.datapath=0\fR" 4 .IX Item "-D nbdkit.backend.datapath=0" .IP "\fB\-D nbdkit.backend.datapath=1\fR" 4 .IX Item "-D nbdkit.backend.datapath=1" .PD These flags control the verbosity of nbdkit backend debugging messages (the ones which show every request processed by the server). The default for both settings is \f(CW1\fR (normal debugging) but you can set them to \f(CW0\fR to suppress these messages. .Sp \&\fI\-D\ nbdkit.backend.datapath=0\fR is the more useful setting which lets you suppress messages about pread, pwrite, zero, trim, etc. commands. When transferring large amounts of data these messages are numerous and not usually very interesting. .Sp \&\fI\-D\ nbdkit.backend.controlpath=0\fR suppresses the non-datapath commands (config, open, close, can_write, etc.) .IP "\fB\-D nbdkit.environ=1\fR" 4 .IX Item "-D nbdkit.environ=1" Print nbdkit's environment variables in the debug output at start up. This is insecure because environment variables may contain both sensitive and user-controlled information, so it should not be used routinely. But it is useful for tracking down problems related to environment variables. .IP "\fB\-D nbdkit.tls.log=\fRN" 4 .IX Item "-D nbdkit.tls.log=N" Enable TLS logging. \f(CW\*(C`N\*(C'\fR can be in the range 0 (no logging) to 99. See \fBgnutls_global_set_log_level\fR\|(3). .IP "\fB\-D nbdkit.tls.session=1\fR" 4 .IX Item "-D nbdkit.tls.session=1" Print additional information about the TLS session, such as the type of authentication and encryption, and client certificate information. .SH SIGNALS .IX Header "SIGNALS" nbdkit 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 "ENVIRONMENT VARIABLES" .IX Header "ENVIRONMENT VARIABLES" .ie n .IP """LISTEN_FDS""" 4 .el .IP \f(CWLISTEN_FDS\fR 4 .IX Item "LISTEN_FDS" .PD 0 .ie n .IP """LISTEN_PID""" 4 .el .IP \f(CWLISTEN_PID\fR 4 .IX Item "LISTEN_PID" .PD If present in the environment when nbdkit starts up, these trigger "SOCKET ACTIVATION" in \fBnbdkit\-service\fR\|(1). .SH "SEE ALSO" .IX Header "SEE ALSO" .SS "Other topics" .IX Subsection "Other topics" \&\fBnbdkit\-captive\fR\|(1) — Run nbdkit under another process and have it reliably cleaned up. .PP \&\fBnbdkit\-client\fR\|(1) — How to mount NBD filesystems on a client machine. .PP \&\fBnbdkit\-loop\fR\|(1) — Use nbdkit with the Linux kernel client to create loop devices and loop mounts. .PP \&\fBnbdkit\-probing\fR\|(1) — How to probe for nbdkit configuration and plugins. .PP \&\fBnbdkit\-protocol\fR\|(1) — Which parts of the NBD protocol nbdkit supports. .PP \&\fBnbdkit\-security\fR\|(1) — Lists past security issues in nbdkit. .PP \&\fBnbdkit\-service\fR\|(1) — Running nbdkit as a service, and systemd socket activation. .PP \&\fBnbdkit\-tls\fR\|(1) — Authentication and encryption of NBD connections (sometimes incorrectly called "SSL"). .SS Plugins .IX Subsection "Plugins" \&\fBnbdkit\-blkio\-plugin\fR\|(1), \&\fBnbdkit\-cdi\-plugin\fR\|(1), \&\fBnbdkit\-curl\-plugin\fR\|(1), \&\fBnbdkit\-data\-plugin\fR\|(1), \&\fBnbdkit\-eval\-plugin\fR\|(1), \&\fBnbdkit\-example1\-plugin\fR\|(1), \&\fBnbdkit\-example2\-plugin\fR\|(1), \&\fBnbdkit\-example3\-plugin\fR\|(1), \&\fBnbdkit\-example4\-plugin\fR\|(1), \&\fBnbdkit\-file\-plugin\fR\|(1), \&\fBnbdkit\-floppy\-plugin\fR\|(1), \&\fBnbdkit\-full\-plugin\fR\|(1), \&\fBnbdkit\-guestfs\-plugin\fR\|(1), \&\fBnbdkit\-info\-plugin\fR\|(1), \&\fBnbdkit\-iso\-plugin\fR\|(1), \&\fBnbdkit\-libvirt\-plugin\fR\|(1), \&\fBnbdkit\-linuxdisk\-plugin\fR\|(1), \&\fBnbdkit\-memory\-plugin\fR\|(1), \&\fBnbdkit\-nbd\-plugin\fR\|(1), \&\fBnbdkit\-null\-plugin\fR\|(1), \&\fBnbdkit\-ondemand\-plugin\fR\|(1), \&\fBnbdkit\-ones\-plugin\fR\|(1), \&\fBnbdkit\-partitioning\-plugin\fR\|(1), \&\fBnbdkit\-pattern\-plugin\fR\|(1), \&\fBnbdkit\-random\-plugin\fR\|(1), \&\fBnbdkit\-S3\-plugin\fR\|(1), \&\fBnbdkit\-sparse\-random\-plugin\fR\|(1), \&\fBnbdkit\-split\-plugin\fR\|(1), \&\fBnbdkit\-ssh\-plugin\fR\|(1), \&\fBnbdkit\-tmpdisk\-plugin\fR\|(1), \&\fBnbdkit\-torrent\-plugin\fR\|(1), \&\fBnbdkit\-vddk\-plugin\fR\|(1), \&\fBnbdkit\-zero\-plugin\fR\|(1) ; \&\fBnbdkit\-cc\-plugin\fR\|(3), \&\fBnbdkit\-golang\-plugin\fR\|(3), \&\fBnbdkit\-lua\-plugin\fR\|(3), \&\fBnbdkit\-ocaml\-plugin\fR\|(3), \&\fBnbdkit\-perl\-plugin\fR\|(3), \&\fBnbdkit\-python\-plugin\fR\|(3), \&\fBnbdkit\-ruby\-plugin\fR\|(3), \&\fBnbdkit\-rust\-plugin\fR\|(3), \&\fBnbdkit\-sh\-plugin\fR\|(3), \&\fBnbdkit\-tcl\-plugin\fR\|(3) \&. .SS Filters .IX Subsection "Filters" \&\fBnbdkit\-blocksize\-filter\fR\|(1), \&\fBnbdkit\-blocksize\-policy\-filter\fR\|(1), \&\fBnbdkit\-cache\-filter\fR\|(1), \&\fBnbdkit\-cacheextents\-filter\fR\|(1), \&\fBnbdkit\-checkwrite\-filter\fR\|(1), \&\fBnbdkit\-cow\-filter\fR\|(1), \&\fBnbdkit\-ddrescue\-filter\fR\|(1), \&\fBnbdkit\-delay\-filter\fR\|(1), \&\fBnbdkit\-error\-filter\fR\|(1), \&\fBnbdkit\-exitlast\-filter\fR\|(1), \&\fBnbdkit\-exitwhen\-filter\fR\|(1), \&\fBnbdkit\-exportname\-filter\fR\|(1), \&\fBnbdkit\-ext2\-filter\fR\|(1), \&\fBnbdkit\-extentlist\-filter\fR\|(1), \&\fBnbdkit\-evil\-filter\fR\|(1), \&\fBnbdkit\-fua\-filter\fR\|(1), \&\fBnbdkit\-gzip\-filter\fR\|(1), \&\fBnbdkit\-ip\-filter\fR\|(1), \&\fBnbdkit\-limit\-filter\fR\|(1), \&\fBnbdkit\-log\-filter\fR\|(1), \&\fBnbdkit\-luks\-filter\fR\|(1), \&\fBnbdkit\-multi\-conn\-filter\fR\|(1), \&\fBnbdkit\-nocache\-filter\fR\|(1), \&\fBnbdkit\-noextents\-filter\fR\|(1), \&\fBnbdkit\-nofilter\-filter\fR\|(1), \&\fBnbdkit\-noparallel\-filter\fR\|(1), \&\fBnbdkit\-nozero\-filter\fR\|(1), \&\fBnbdkit\-offset\-filter\fR\|(1), \&\fBnbdkit\-partition\-filter\fR\|(1), \&\fBnbdkit\-pause\-filter\fR\|(1), \&\fBnbdkit\-protect\-filter\fR\|(1), \&\fBnbdkit\-qcow2dec\-filter\fR\|(1), \&\fBnbdkit\-rate\-filter\fR\|(1), \&\fBnbdkit\-readahead\-filter\fR\|(1), \&\fBnbdkit\-retry\-filter\fR\|(1), \&\fBnbdkit\-retry\-request\-filter\fR\|(1), \&\fBnbdkit\-scan\-filter\fR\|(1), \&\fBnbdkit\-stats\-filter\fR\|(1), \&\fBnbdkit\-swab\-filter\fR\|(1), \&\fBnbdkit\-tar\-filter\fR\|(1), \&\fBnbdkit\-tls\-fallback\-filter\fR\|(1), \&\fBnbdkit\-truncate\-filter\fR\|(1), \&\fBnbdkit\-xz\-filter\fR\|(1) \&. .SS "For developers" .IX Subsection "For developers" \&\fBnbdkit\-plugin\fR\|(3), \&\fBnbdkit\-filter\fR\|(3). .SS "Writing plugins in other programming languages" .IX Subsection "Writing plugins in other programming languages" \&\fBnbdkit\-cc\-plugin\fR\|(3), \&\fBnbdkit\-golang\-plugin\fR\|(3), \&\fBnbdkit\-lua\-plugin\fR\|(3), \&\fBnbdkit\-ocaml\-plugin\fR\|(3), \&\fBnbdkit\-perl\-plugin\fR\|(3), \&\fBnbdkit\-python\-plugin\fR\|(3), \&\fBnbdkit\-ruby\-plugin\fR\|(3), \&\fBnbdkit\-rust\-plugin\fR\|(3), \&\fBnbdkit\-sh\-plugin\fR\|(3), \&\fBnbdkit\-tcl\-plugin\fR\|(3) \&. .SS "Release notes for previous releases of nbdkit" .IX Subsection "Release notes for previous releases of nbdkit" \&\fBnbdkit\-release\-notes\-1.36\fR\|(1), \&\fBnbdkit\-release\-notes\-1.34\fR\|(1), \&\fBnbdkit\-release\-notes\-1.32\fR\|(1), \&\fBnbdkit\-release\-notes\-1.30\fR\|(1), \&\fBnbdkit\-release\-notes\-1.28\fR\|(1), \&\fBnbdkit\-release\-notes\-1.26\fR\|(1), \&\fBnbdkit\-release\-notes\-1.24\fR\|(1), \&\fBnbdkit\-release\-notes\-1.22\fR\|(1), \&\fBnbdkit\-release\-notes\-1.20\fR\|(1), \&\fBnbdkit\-release\-notes\-1.18\fR\|(1), \&\fBnbdkit\-release\-notes\-1.16\fR\|(1), \&\fBnbdkit\-release\-notes\-1.14\fR\|(1), \&\fBnbdkit\-release\-notes\-1.12\fR\|(1), \&\fBnbdkit\-release\-notes\-1.10\fR\|(1), \&\fBnbdkit\-release\-notes\-1.8\fR\|(1), \&\fBnbdkit\-release\-notes\-1.6\fR\|(1), \&\fBnbdkit\-release\-notes\-1.4\fR\|(1). .SS "NBD clients" .IX Subsection "NBD clients" \&\fBguestfish\fR\|(1), \&\fBlibnbd\fR\|(3), \&\fBnbd\-client\fR\|(1), \&\fBnbdcopy\fR\|(1), \&\fBnbdfuse\fR\|(1), \&\fBnbdinfo\fR\|(1), \&\fBnbdsh\fR\|(1), \&\fBqemu\fR\|(1). .SS "nbdkit links" .IX Subsection "nbdkit links" http://gitlab.com/nbdkit/nbdkit — Source code. .SS "Other NBD servers" .IX Subsection "Other NBD servers" \&\fBqemu\-nbd\fR\|(1), \&\fBnbd\-server\fR\|(1), https://github.com/bignaux/lwNBD, https://bitbucket.org/hirofuchi/xnbd. .SS "Documentation for the NBD protocol" .IX Subsection "Documentation for the NBD protocol" https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md, https://nbd.sourceforge.io/. .SS "Similar protocols" .IX Subsection "Similar protocols" https://en.wikipedia.org/wiki/iSCSI, https://en.wikipedia.org/wiki/ATA_over_Ethernet, https://en.wikipedia.org/wiki/Fibre_Channel_over_Ethernet. .SS "Other manual pages of interest" .IX Subsection "Other manual pages of interest" \&\fBgnutls_priority_init\fR\|(3), \&\fBqemu\-img\fR\|(1), \&\fBpsktool\fR\|(1), \&\fBsystemd.socket\fR\|(5). .SH AUTHORS .IX Header "AUTHORS" Eric Blake .PP Laszlo Ersek .PP Richard W.M. Jones .PP Yann E. MORIN .PP Nikolaus Rath .PP François Revol .PP Nir Soffer .PP Alan Somers .PP Pino Toscano .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright Red Hat .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 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.