1nbdkit-offset-filter(1) NBDKIT nbdkit-offset-filter(1)
2
3
4
6 nbdkit-offset-filter - nbdkit offset filter
7
9 nbdkit --filter=offset plugin offset=OFFSET range=LENGTH [plugin-args...]
10
12 "nbdkit-offset-filter" is a filter that limits requests to the byte
13 range "[offset .. offset+range-1]" within another plugin.
14
16 offset=OFFSET
17 The start offset. The offset must be ≥ 0.
18
19 This parameter is optional. If not given then "offset=0" is
20 assumed.
21
22 range=LENGTH
23 The length of data to serve.
24
25 This parameter is optional. If not given then the range is served
26 starting from the offset through to the end of the underlying
27 file/device.
28
29 Note it is an error if the offset and/or range specify data which lies
30 beyond the end of the underlying device. Use nbdkit-truncate-filter(1)
31 to truncate or extend the size of plugins.
32
34 Serve part of a file
35 Using nbdkit-file-plugin(1), serve the file "disk.img" starting at
36 offset "1M". The total length served is "100M" (the underlying file
37 must therefore be at least "101M" in length):
38
39 nbdkit --filter=offset file disk.img offset=1M range=100M
40
41 Serve a single partition
42 An easier way to do this is with nbdkit-partition-filter(1).
43
44 One way to serve a single partition from a disk is to find the start
45 and length of the partition, eg using:
46
47 $ parted disk.img -- unit b print
48 ...
49 Number Start End Size Type File system Flags
50 1 65536B 104792575B 104727040B primary ext2
51
52 You can then serve the partition only using:
53
54 nbdkit --filter=offset file disk.img offset=65536 range=104727040
55
57 $filterdir/nbdkit-offset-filter.so
58 The filter.
59
60 Use "nbdkit --dump-config" to find the location of $filterdir.
61
63 "nbdkit-offset-filter" first appeared in nbdkit 1.2.
64
66 nbdkit(1), nbdkit-file-plugin(1), nbdkit-filter(3),
67 nbdkit-partition-filter(1), nbdkit-truncate-filter(1).
68
70 Eric Blake
71
72 Richard W.M. Jones
73
75 Copyright (C) 2018 Red Hat Inc.
76
78 Redistribution and use in source and binary forms, with or without
79 modification, are permitted provided that the following conditions are
80 met:
81
82 · Redistributions of source code must retain the above copyright
83 notice, this list of conditions and the following disclaimer.
84
85 · Redistributions in binary form must reproduce the above copyright
86 notice, this list of conditions and the following disclaimer in the
87 documentation and/or other materials provided with the
88 distribution.
89
90 · Neither the name of Red Hat nor the names of its contributors may
91 be used to endorse or promote products derived from this software
92 without specific prior written permission.
93
94 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
95 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
96 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
97 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
98 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
99 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
100 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
101 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
102 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
103 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
104 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
105
106
107
108nbdkit-1.16.1 2019-12-03 nbdkit-offset-filter(1)