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-tar-filter(1),
68 nbdkit-truncate-filter(1).
69
71 Eric Blake
72
73 Richard W.M. Jones
74
76 Copyright (C) 2018 Red Hat Inc.
77
79 Redistribution and use in source and binary forms, with or without
80 modification, are permitted provided that the following conditions are
81 met:
82
83 • Redistributions of source code must retain the above copyright
84 notice, this list of conditions and the following disclaimer.
85
86 • Redistributions in binary form must reproduce the above copyright
87 notice, this list of conditions and the following disclaimer in the
88 documentation and/or other materials provided with the
89 distribution.
90
91 • Neither the name of Red Hat nor the names of its contributors may
92 be used to endorse or promote products derived from this software
93 without specific prior written permission.
94
95 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
96 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
97 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
98 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
99 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
100 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
101 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
102 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
103 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
104 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
105 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
106
107
108
109nbdkit-1.25.8 2021-05-25 nbdkit-offset-filter(1)