---
name: "nbdkit-offset-filter"
section: "1"
platform: "linux"
package: "nbdkit"
version: "1.42.3-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/nbdkit-offset-filter"
---

# nbdkit-offset-filter(1)

nbdkit offset filter

## NAME

nbdkit-offset-filter - 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)](/nbdkit-truncate-filter/1.md) to truncate or extend the size of plugins.

## EXAMPLES

### Serve part of a file

Using [**nbdkit-file-plugin**(1)](/nbdkit-file-plugin/1.md), 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/1.md), [**nbdkit-file-plugin**(1)](/nbdkit-file-plugin/1.md), [**nbdkit-filter**(3)](/nbdkit-filter/3.md), [**nbdkit-partition-filter**(1)](/nbdkit-partition-filter/1.md), [**nbdkit-protect-filter**(1)](/nbdkit-protect-filter/1.md), [**nbdkit-tar-filter**(1)](/nbdkit-tar-filter/1.md), [**nbdkit-truncate-filter**(1)](/nbdkit-truncate-filter/1.md).

## AUTHORS

Eric Blake

Richard W.M. Jones

## COPYRIGHT

Copyright Red Hat

## LICENSE

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

- •

  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

- •

  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.

- •

  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.

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.
