.\" Automatically generated by Podwrapper::Man 1.28.5 (Pod::Simple 3.42) .\" .\" 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 >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-streaming-plugin 1" .TH nbdkit-streaming-plugin 1 "2021-10-25" "nbdkit-1.28.5" "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\-streaming\-plugin \- nbdkit streaming plugin .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& nbdkit streaming write=PIPE [size=SIZE] \& \& nbdkit streaming read=PIPE [size=SIZE] .Ve .SH "DEPRECATED" .IX Header "DEPRECATED" \&\fBThe streaming plugin is deprecated in nbdkit ≥ 1.26 and will be removed in nbdkit 1.30\fR. .PP A suggested replacement is the libnbd program \fBnbdcopy\fR\|(1) which is able to stream to and from pipes, sockets and stdio. For example to stream from a qcow2 file to another program over a pipe, use: .PP .Vb 1 \& nbdcopy \-\- [ qemu\-nbd \-f qcow2 file.qcow2 ] \- | hexdump \-C .Ve .PP There are further examples in the \fBnbdcopy\fR\|(1) manual. .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`nbdkit\-streaming\-plugin\*(C'\fR is a plugin for \fBnbdkit\fR\|(1) that can stream in or out of a local pipe or socket. An alternate tool which can do something similar to this is \fBnbdcopy\fR\|(1). To turn an \s-1NBD\s0 export into a local file use \fBnbdfuse\fR\|(1). .PP If the \s-1NBD\s0 client opens the \s-1NBD\s0 port and \fIwrites\fR from the start to the end of the disk without seeking backwards, then you can turn that into a stream of data on a local pipe or socket using: .PP .Vb 1 \& nbdkit streaming write=./pipe .Ve .PP This can be visualised as: .PP .Vb 5 \& ┌───────────┐ \& NBD │ nbdkit │ plugin streams \& client ──────▶│ streaming │──────▶ data to ./pipe \& writes │ plugin │ \& └───────────┘ .Ve .PP If the \s-1NBD\s0 client opens the \s-1NBD\s0 port and \fIreads\fR from the start to the end of the disk without seeking backwards, then you can turn a local pipe or socket into a stream of data for that client: .PP .Vb 1 \& nbdkit streaming read=./pipe .Ve .PP This can be visualised as: .PP .Vb 5 \& ┌───────────┐ \& plugin streams │ nbdkit │ NBD \& data from ──────▶│ streaming │──────▶ client \& ./pipe │ plugin │ reads \& └───────────┘ .Ve .PP Note that \fI./pipe\fR (or the local socket) sees raw data, it is not using the \s-1NBD\s0 protocol. If you want to forward \s-1NBD\s0 to a local socket connected to another \s-1NBD\s0 server, use \fBnbdkit\-nbd\-plugin\fR\|(1). .SS "Combining this plugin with qemu tools" .IX Subsection "Combining this plugin with qemu tools" Typical usage is with qemu tools. The following command does \fInot\fR work because the output is a pipe or socket: .PP .Vb 4 \& $ mkfifo pipe \& $ qemu\-img convert \-n input \-O raw ./pipe \& qemu\-img: Could not open \*(Aq./pipe\*(Aq: A regular file was expected by \& the \*(Aqfile\*(Aq driver, but something else was given .Ve .PP However this will work: .PP .Vb 2 \& nbdkit \-U \- streaming write=./pipe \e \& \-\-run \*(Aq qemu\-img convert \-n input \-O raw $nbd \*(Aq \& \& ┌───────────┐ ┌───────────┐ \& reads │ qemu\-img │ │ nbdkit │ plugin streams \& input ──────▶│ convert │──────▶│ streaming │──────▶ data to ./pipe \& file │ command │ │ plugin │ \& └───────────┘ ↑└───────────┘ \& Unix domain socket (\-U \-) .Ve .PP This only works because the output format is raw and qemu-img can write that linearly (without seeking backwards or writing blocks out of order). This approach cannot work for other formats such as qcow2 since those contain metadata that must be updated by seeking back to the start of the file which is not possible if the output is a pipe. .PP The reverse is to get qemu-img to read from a pipe: .PP .Vb 2 \& nbdkit \-U \- streaming read=./pipe \e \& \-\-run \*(Aq qemu\-img convert \-f raw $nbd \-O qcow2 output.qcow2 \*(Aq .Ve .PP For use of the \fI\-\-run\fR and \fI\-U \-\fR options, see \&\fBnbdkit\-captive\fR\|(1). .SH "PARAMETERS" .IX Header "PARAMETERS" Either \f(CW\*(C`read\*(C'\fR or \f(CW\*(C`write\*(C'\fR is required, but not both. .IP "\fBread=\fR\s-1FILENAME\s0" 4 .IX Item "read=FILENAME" (nbdkit ≥ 1.22) .Sp Read data stream from the named pipe or socket. If the pipe or socket does not exist, then it is created (as a named \s-1FIFO\s0), otherwise the existing pipe or socket is opened and used. .IP "\fBwrite=\fR\s-1FILENAME\s0" 4 .IX Item "write=FILENAME" Write data stream to the named pipe or socket. If the pipe or socket does not exist, then it is created (as a named \s-1FIFO\s0), otherwise the existing pipe or socket is opened and used. .IP "\fBpipe=\fR\s-1FILENAME\s0" 4 .IX Item "pipe=FILENAME" For backwards compatibility with nbdkit ≤ 1.20 this is a synonym for \f(CW\*(C`write=FILENAME\*(C'\fR. .IP "\fBsize=\fR\s-1SIZE\s0" 4 .IX Item "size=SIZE" Specify the virtual size of the stream. .Sp This parameter is optional. If not specified, then the virtual disk appears to the client to be very large (effectively infinite). Whether you need to specify this parameter depends on the client. Some clients don't check the size and just write/stream, others do checks or calculations based on the apparent size. It is not possible for the plugin to work out the size itself since it doesn't see the whole stream until it has all been streamed. .SH "FILES" .IX Header "FILES" .IP "\fI\f(CI$plugindir\fI/nbdkit\-streaming\-plugin.so\fR" 4 .IX Item "$plugindir/nbdkit-streaming-plugin.so" The plugin. .Sp Use \f(CW\*(C`nbdkit \-\-dump\-config\*(C'\fR to find the location of \f(CW$plugindir\fR. .SH "VERSION" .IX Header "VERSION" \&\f(CW\*(C`nbdkit\-streaming\-plugin\*(C'\fR first appeared in nbdkit 1.2. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBnbdkit\fR\|(1), \&\fBnbdkit\-file\-plugin\fR\|(1), \&\fBnbdkit\-nbd\-plugin\fR\|(1), \&\fBnbdkit\-plugin\fR\|(3), \&\fBnbdkit\-captive\fR\|(1), \&\fBnbdcopy\fR\|(1), \&\fBnbdfuse\fR\|(1), \&\fBqemu\-img\fR\|(1). .SH "AUTHORS" .IX Header "AUTHORS" Richard W.M. Jones .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2014\-2020 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