1nbdkit-tar-plugin(1) NBDKIT nbdkit-tar-plugin(1)
2
3
4
6 nbdkit-tar-plugin - read and write files inside tar files without
7 unpacking
8
10 nbdkit tar [tar=]FILENAME.tar file=PATH_INSIDE_TAR
11
13 The tar plugin is deprecated in nbdkit ≥ 1.22.16 and will be removed in
14 nbdkit 1.26. It has been replaced with a filter with the same
15 functionality, see nbdkit-tar-filter(1). You can use the filter like
16 this:
17
18 nbdkit file FILENAME.tar --filter=tar tar-entry=PATH_INSIDE_TAR
19
21 Serve a single file inside a tarball
22 nbdkit tar file.tar file=some/disk.img
23 guestfish --format=raw -a nbd://localhost
24
25 Opening a disk image inside an OVA file
26 The popular "Open Virtual Appliance" (OVA) format is really an
27 uncompressed tar file containing (usually) VMDK-format files, so you
28 could access one file in an OVA like this:
29
30 $ tar tf rhel.ova
31 rhel.ovf
32 rhel-disk1.vmdk
33 rhel.mf
34 $ nbdkit -r tar rhel.ova file=rhel-disk1.vmdk
35 $ guestfish --ro --format=vmdk -a nbd://localhost
36
37 In this case the tarball is opened readonly (-r option). The plugin
38 supports write access, but writing to the VMDK file in the tarball does
39 not change data checksums stored in other files (the "rhel.mf" file in
40 this example), and as these will become incorrect you probably won't be
41 able to open the file with another tool afterwards.
42
44 "nbdkit-tar-plugin" is a plugin which can read and writes files inside
45 an uncompressed tar file without unpacking the tar file.
46
47 The "tar" and "file" parameters are required, specifying the name of
48 the uncompressed tar file and the exact path of the file within the tar
49 file to access as a disk image.
50
51 This plugin will not work on compressed tar files.
52
53 Use the nbdkit -r flag to open the file readonly. This is the safest
54 option because it guarantees that the tar file will not be modified.
55 Without -r writes will modify the tar file.
56
57 The disk image cannot be resized.
58
60 [tar=]FILENAME.tar
61 The path of the tarball. This parameter is required.
62
63 "tar=" is a magic config key and may be omitted in most cases. See
64 "Magic parameters" in nbdkit(1).
65
66 file=PATH_INSIDE_TAR
67 The path of the file inside the tarball to serve. This parameter
68 is required. It must exactly match the name stored in the tarball,
69 so use "tar tf filename.tar"
70
72 Alternatives to the tar plugin
73 The tar plugin ought to be a filter so that you can extract files from
74 within tarballs hosted elsewhere (eg. using nbdkit-curl-plugin(1)).
75 However this is hard to implement given the way that the tar(1) command
76 works.
77
78 Nevertheless you can apply the same technique even to tarballs hosted
79 remotely, provided you can run tar(1) on them first. The trick is to
80 use the "tar -tRvf" options to find the block number of the file of
81 interest. In tar files, blocks are 512 bytes in size, and there is one
82 hidden block used for the header, so you have to take the block number,
83 add 1, and multiply by 512.
84
85 For example:
86
87 $ tar -tRvf disk.tar
88 block 2: -rw-r--r-- rjones/rjones 105923072 2020-03-28 20:34 disk
89 └──┬──┘ └───┬───┘
90 offset = (2+1)*512 = 1536 range
91
92 You can then apply the offset filter:
93
94 nbdkit --filter=offset \
95 curl https://example.com/disk.tar \
96 offset=1536 range=105923072
97
98 If the remote file is compressed then add nbdkit-xz-filter(1):
99
100 nbdkit --filter=offset --filter=xz \
101 curl https://example.com/disk.tar.xz \
102 offset=1536 range=105923072
103
105 "nbdkit-tar-plugin" first appeared in nbdkit 1.2.
106
108 nbdkit(1), nbdkit-offset-filter(1), nbdkit-plugin(3),
109 nbdkit-tar-filter(1), nbdkit-xz-filter(1), tar(1).
110
112 Richard W.M. Jones.
113
114 Based on the virt-v2v OVA importer written by Tomáš Golembiovský.
115
117 Copyright (C) 2017-2020 Red Hat Inc.
118
120 Redistribution and use in source and binary forms, with or without
121 modification, are permitted provided that the following conditions are
122 met:
123
124 · Redistributions of source code must retain the above copyright
125 notice, this list of conditions and the following disclaimer.
126
127 · Redistributions in binary form must reproduce the above copyright
128 notice, this list of conditions and the following disclaimer in the
129 documentation and/or other materials provided with the
130 distribution.
131
132 · Neither the name of Red Hat nor the names of its contributors may
133 be used to endorse or promote products derived from this software
134 without specific prior written permission.
135
136 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
137 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
138 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
139 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
140 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
141 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
142 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
143 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
144 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
145 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
146 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
147
148
149
150nbdkit-1.22.3 2020-09-26 nbdkit-tar-plugin(1)