nbdkit-offset-filter - Man Page

nbdkit offset filter

Synopsis

 nbdkit --filter=offset plugin offset=OFFSET range=LENGTH [plugin-args...]

Description

nbdkit-offset-filter is a filter that limits requests to the byte range [offset .. offset+range-1] within another plugin.

Parameters

offset=OFFSET

The start offset.  The offset must be ≥ 0.

This parameter is optional.  If not given then offset=0 is assumed.

range=LENGTH

The length of data to serve.

This parameter is optional.  If not given then the range is served starting from the offset through to the end of the underlying file/device.

Note it is an error if the offset and/or range specify data which lies beyond the end of the underlying device.  Use nbdkit-truncate-filter(1) to truncate or extend the size of plugins.

Examples

Serve part of a file

Using nbdkit-file-plugin(1), serve the file disk.img starting at offset 1M.  The total length served is 100M (the underlying file must therefore be at least 101M in length):

 nbdkit --filter=offset file disk.img offset=1M range=100M

Serve a single partition

An easier way to do this is with nbdkit-partition-filter(1).

One way to serve a single partition from a disk is to find the start and length of the partition, eg using:

 $ parted disk.img -- unit b print
 ...
 Number  Start   End         Size        Type     File system  Flags
  1      65536B  104792575B  104727040B  primary  ext2

You can then serve the partition only using:

 nbdkit --filter=offset file disk.img offset=65536 range=104727040

Files

$filterdir/nbdkit-offset-filter.so

The filter.

Use nbdkit --dump-config to find the location of $filterdir.

Version

nbdkit-offset-filter first appeared in nbdkit 1.2.

See Also

nbdkit(1), nbdkit-file-plugin(1), nbdkit-filter(3), nbdkit-partition-filter(1), nbdkit-protect-filter(1), nbdkit-tar-filter(1), nbdkit-truncate-filter(1).

Authors

Eric Blake

Richard W.M. Jones

License

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

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.

Referenced By

nbdkit(1), nbdkit-filter(3), nbdkit-partition-filter(1), nbdkit-pattern-plugin(1), nbdkit-protect-filter(1), nbdkit-tar-filter(1), nbdkit-truncate-filter(1).

2024-03-18 nbdkit-1.37.13