.\" Automatically generated by Podwrapper::Man 1.20.6 (Pod::Simple 3.35) .\" .\" 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-tar-plugin 1" .TH nbdkit-tar-plugin 1 "2020-06-18" "nbdkit-1.20.6" "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\-plugin \- read and write files inside tar files without unpacking .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& nbdkit tar tar=FILENAME.tar file=PATH_INSIDE_TAR .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 tar tar=file.tar file=some/disk.img \& guestfish \-\-format=raw \-a nbd://localhost .Ve .SS "Opening a disk image inside an \s-1OVA\s0 file" .IX Subsection "Opening a disk image inside an OVA file" The popular \*(L"Open Virtual Appliance\*(R" (\s-1OVA\s0) format is really an uncompressed tar file containing (usually) VMDK-format files, so you could access one file in an \s-1OVA\s0 like this: .PP .Vb 6 \& $ tar tf rhel.ova \& rhel.ovf \& rhel\-disk1.vmdk \& rhel.mf \& $ nbdkit \-r tar tar=rhel.ova file=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 \s-1VMDK\s0 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. .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`nbdkit\-tar\-plugin\*(C'\fR is a plugin which can read and writes files inside an uncompressed tar file without unpacking the tar file. .PP The \f(CW\*(C`tar\*(C'\fR and \f(CW\*(C`file\*(C'\fR parameters are required, specifying the name of the uncompressed tar file and the exact path of the file within the tar file to access as a disk image. .PP This plugin will \fBnot\fR work on compressed tar files. .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. .SS "Alternatives to the tar plugin" .IX Subsection "Alternatives to the tar plugin" The tar plugin ought to be a filter so that you can extract files from within tarballs hosted elsewhere (eg. using \fBnbdkit\-curl\-plugin\fR\|(1)). However this is hard to implement given the way that the \fBtar\fR\|(1) command works. .PP Nevertheless you can apply the same technique even to tarballs hosted remotely, provided you can run \fBtar\fR\|(1) on them first. The trick is to use the \f(CW\*(C`tar \-tRvf\*(C'\fR options to find the block number of the file of interest. In tar files, blocks are 512 bytes in size, and there is one hidden block used for the header, so you have to take the block number, add 1, and multiply by 512. .PP For example: .PP .Vb 4 \& $ tar \-tRvf disk.tar \& block 2: \-rw\-r\-\-r\-\- rjones/rjones 105923072 2020\-03\-28 20:34 disk \& └──┬──┘ └───┬───┘ \& offset = (2+1)*512 = 1536 range .Ve .PP You can then apply the offset filter: .PP .Vb 3 \& nbdkit \-\-filter=offset \e \& curl https://example.com/disk.tar \e \& offset=1536 range=105923072 .Ve .PP If the remote file is compressed then add \fBnbdkit\-xz\-filter\fR\|(1): .PP .Vb 3 \& nbdkit \-\-filter=offset \-\-filter=xz \e \& curl https://example.com/disk.tar.xz \e \& offset=1536 range=105923072 .Ve .SH "VERSION" .IX Header "VERSION" \&\f(CW\*(C`nbdkit\-tar\-plugin\*(C'\fR first appeared in nbdkit 1.2. .SH "SEE ALSO" .IX Header "SEE ALSO" https://github.com/libguestfs/nbdkit/blob/master/plugins/tar/tar.pl, \&\fBnbdkit\fR\|(1), \&\fBnbdkit\-offset\-filter\fR\|(1), \&\fBnbdkit\-plugin\fR\|(3), \&\fBnbdkit\-perl\-plugin\fR\|(3), \&\fBnbdkit\-xz\-filter\fR\|(1), \&\fBtar\fR\|(1). .SH "AUTHORS" .IX Header "AUTHORS" Richard W.M. Jones. .PP Based on the virt\-v2v \s-1OVA\s0 importer written by Tomáš Golembiovský. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2017\-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