.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Podwrapper::Man 1.38.1 (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-tar-filter 1" .TH nbdkit-tar-filter 1 2024-04-21 nbdkit-1.38.1 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\-tar\-filter \- read and write files inside tar files without unpacking .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 3 \& nbdkit file FILENAME.tar \& \-\-filter=tar tar\-entry=PATH_INSIDE_TAR \& [tar=TAR_COMMAND] [tar\-limit=SIZE] .Ve .SH EXAMPLES .IX Header "EXAMPLES" .SS "Serve a single file inside a tarball" .IX Subsection "Serve a single file inside a tarball" .Vb 2 \& nbdkit file file.tar \-\-filter=tar tar\-entry=some/disk.img \& guestfish \-\-format=raw \-a nbd://localhost .Ve .SS "Opening a disk image inside an OVA file" .IX Subsection "Opening a disk image inside an OVA file" The popular "Open Virtual Appliance" (OVA) format is really an uncompressed tar file containing (usually) VMDK-format files, so you could access one file in an OVA like this: .PP .Vb 6 \& $ tar tf rhel.ova \& rhel.ovf \& rhel\-disk1.vmdk \& rhel.mf \& $ nbdkit \-r file rhel.ova \-\-filter=tar tar\-entry=rhel\-disk1.vmdk \& $ guestfish \-\-ro \-\-format=vmdk \-a nbd://localhost .Ve .PP In this case the tarball is opened readonly (\fI\-r\fR option). The plugin supports write access, but writing to the VMDK file in the tarball does not change data checksums stored in other files (the \&\f(CW\*(C`rhel.mf\*(C'\fR file in this example), and as these will become incorrect you probably won't be able to open the file with another tool afterwards. .SS "Open a disk image inside a remote tar file" .IX Subsection "Open a disk image inside a remote tar file" You can use other plugins apart from \fBnbdkit\-file\-plugin\fR\|(1) to provide the tar file. For example if the tar file is located on a web server use: .PP .Vb 2 \& nbdkit \-r curl https://example.com/file.tar \e \& \-\-filter=tar tar\-entry=disk.img .Ve .SS "Open a compressed tar file (read-only)" .IX Subsection "Open a compressed tar file (read-only)" This filter cannot handle compressed tar files itself, but you can combine it with \fBnbdkit\-gzip\-filter\fR\|(1) or \fBnbdkit\-xz\-filter\fR\|(1): .PP .Vb 4 \& nbdkit file filename.tar.gz \e \& \-\-filter=tar tar\-entry=disk.img \-\-filter=gzip \& nbdkit file filename.tar.xz \e \& \-\-filter=tar tar\-entry=disk.img \-\-filter=xz .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\f(CW\*(C`nbdkit\-tar\-filter\*(C'\fR is a filter which can read and writes files inside an uncompressed tar file without unpacking the tar file. .PP The tar file is provided by the underlying plugin. You must tell the filter which entry in the tar file you wish to read and write using the \f(CW\*(C`tar\-entry\*(C'\fR parameter. \f(CW\*(C`tar\-entry\*(C'\fR must exactly match the file name in the tar index. Use \f(CW\*(C`tar tf filename.tar\*(C'\fR to list the index of a tar file. .PP This filter will \fBnot\fR work directly on compressed tar files. You have to combine it with another filter as shown in the example above. .PP Use the nbdkit \fI\-r\fR flag to open the file readonly. This is the safest option because it guarantees that the tar file will not be modified. Without \fI\-r\fR writes will modify the tar file. .PP The disk image cannot be resized. .SH PARAMETERS .IX Header "PARAMETERS" .IP [\fBtar\-entry=\fR]PATH_INSIDE_TAR 4 .IX Item "[tar-entry=]PATH_INSIDE_TAR" The path of the file inside the tarball to serve. This parameter is required. It must exactly match the name stored in the tarball, so use \f(CW\*(C`tar\ tf\ filename.tar\*(C'\fR .IP [\fBtar\-limit=\fR]SIZE 4 .IX Item "[tar-limit=]SIZE" When opening the tar file we have to locate the file (\f(CW\*(C`tar\-entry\*(C'\fR) inside the tarball. Because tar files do not have a central index we must iterate over the tar file to find the entry, and that may be costly (especially with untrusted tar files). In the worst case where \&\f(CW\*(C`tar\-entry\*(C'\fR starts near the end of the file we may have to iterate over the whole tar file. If this is a problem you may set \&\f(CW\*(C`tar\-limit\*(C'\fR to some smaller value, eg: .Sp .Vb 3 \& nbdkit \-r curl https://example.com/file.tar \e \& \-\-filter=tar tar\-entry=disk.img \e \& tar\-limit=10M .Ve .Sp which ensures no more than 10 megabytes are read before we give up and reject the tar file (sending an error back to the NBD client). .Sp The default is 0 meaning no limit. .IP \fBtar=gtar\fR 4 .IX Item "tar=gtar" .PD 0 .IP \fBtar=\fR/PATH/TO/GTAR 4 .IX Item "tar=/PATH/TO/GTAR" .PD Specify the program name or full path of GNU tar, in case \f(CW\*(C`tar\*(C'\fR on \&\f(CW$PATH\fR is not GNU tar. This filter requires GNU tar and will not normally work with other tar programs (eg. on FreeBSD). .SH FILES .IX Header "FILES" .ie n .IP \fR\fI$filterdir\fR\fI/nbdkit\-tar\-filter.so\fR 4 .el .IP \fR\f(CI$filterdir\fR\fI/nbdkit\-tar\-filter.so\fR 4 .IX Item "$filterdir/nbdkit-tar-filter.so" The plugin. .Sp Use \f(CW\*(C`nbdkit \-\-dump\-config\*(C'\fR to find the location of \f(CW$filterdir\fR. .SH VERSION .IX Header "VERSION" \&\f(CW\*(C`nbdkit\-tar\-filter\*(C'\fR first appeared in nbdkit 1.22. It is derived from \f(CW\*(C`nbdkit\-tar\-plugin\*(C'\fR which first appeared in nbdkit 1.2. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBnbdkit\fR\|(1), \&\fBnbdkit\-curl\-plugin\fR\|(1), \&\fBnbdkit\-file\-plugin\fR\|(1), \&\fBnbdkit\-gzip\-filter\fR\|(1), \&\fBnbdkit\-offset\-filter\fR\|(1), \&\fBnbdkit\-plugin\fR\|(3), \&\fBnbdkit\-ssh\-plugin\fR\|(1), \&\fBnbdkit\-xz\-filter\fR\|(1), \&\fBtar\fR\|(1). .SH AUTHORS .IX Header "AUTHORS" Richard W.M. Jones. .PP Based on the virt\-v2v OVA importer written by Tomáš Golembiovský. .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.