This is the command nbdkit that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator
PROGRAM:
NAME
nbdkit - A toolkit for creating NBD servers
SYNOPSIS
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 [...]]]
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.
"nbdkit" is both a toolkit for creating NBD servers from "unconventional" sources and the
name of an NBD server.
To create a new Network Block Device source, all you need to do is write 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.
If you want to write an nbdkit plugin, you should read nbdkit-plugin(3).
Several plugins may be found in "$libdir/nbdkit/plugins". You can give the full path to
the plugin, like this:
nbdkit $libdir/nbdkit/plugins/nbdkit-file-plugin.so [...]
but it is usually more convenient to use this equivalent syntax:
nbdkit file [...]
$libdir is set at compile time. To print it out, do:
nbdkit --dump-config
EXAMPLES
Serve file "disk.img" on port 10809:
nbdkit file file=disk.img
Run the example1 plugin and connect to it using guestfish(1):
nbdkit example1
guestfish --ro -a nbd://localhost
Run the example3 plugin and connect to it using guestfish(1):
nbdkit example3 size=1G
guestfish --ro -a nbd://localhost
To display usage information about a specific plugin:
nbdkit --help example1
GLOBAL OPTIONS
--help
Display brief command line usage information and exit.
--dump-config
Dump out the compile-time configuration values 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.
--run CMD
Run nbdkit as a captive subprocess of "CMD". When "CMD" exits, nbdkit is killed. See
"CAPTIVE NBDKIT" below.
This option implies --foreground.
-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
-U -
--unix -
Accept connections on the Unix domain socket "SOCKET" (which is a path).
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.
nbdkit does not 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
"Address already in use" error).
If the socket name is - then nbdkit generates a randomly named private socket. This
is useful with "CAPTIVE NBDKIT".
-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 file file=disk.img
To list all the options supported by a plugin, do:
nbdkit --help file
CAPTIVE NBDKIT
You can run nbdkit as a "captive process", using the --run option. This means that nbdkit
runs as long as (for example) qemu(1) or guestfish(1) is running. When those exit, nbdkit
is killed.
Some examples should make this clear.
To run nbdkit captive under qemu:
nbdkit file file=disk.img --run 'qemu -drive file=$nbd,if=virtio'
On the qemu command line, $nbd is substituted automatically with the right NBD path so it
can connect to nbdkit. When qemu exits, nbdkit is killed and cleaned up automatically.
Running nbdkit captive under guestfish:
nbdkit file file=disk.img --run 'guestfish --format=raw -a $nbd -i'
When guestfish exits, nbdkit is killed.
The following shell variables are available in the --run argument:
$nbd
A URL that refers to the nbdkit port or socket.
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.
$port
If ≠ "", the port number that nbdkit is listening on.
$unixsocket
If ≠ "", the Unix domain socket that nbdkit is listening on.
--run implies --foreground. It is not possible, and probably not desirable, to have
nbdkit fork into the background when using --run.
Even when running captive, nbdkit still listens on the regular TCP/IP port, unless you
specify the -p/-U options. If you want a truly private captive nbdkit, then you should
create a private random Unix socket, like this:
nbdkit -U - plugin [args] --run '...'
SIGNALS
"nbdkit" responds to the following signals:
"SIGINT"
"SIGQUIT"
"SIGTERM"
The server exits cleanly.
"SIGPIPE"
This signal is ignored.
Use nbdkit online using onworks.net services