nbdkit-map-filter(1)

NAME
nbdkit-map-filter - remap disk blocks

SYNOPSIS
 nbdkit --filter=map PLUGIN [map=START-END:DEST [map=...]]
                            [map-size=SIZE]

DESCRIPTION
"nbdkit-map-filter" is an nbdkit(1) filter which can remap parts of the underlying plugin, such as moving a sector or partition.

To select part of a disk, use nbdkit-offset-filter(1) instead. To select a partition, use nbdkit-partition-filter(1). Although this filter can change the size of the disk, nbdkit-truncate-filter(1) is easier to use.

EXAMPLES

  Swap over the first two sectors in a disk
Using two "map" parameters, this remaps the first sector (bytes "0-511") on to the second sector (starting at 512), and the second sector (bytes "512-1023") on to the first sector (0).

 nbdkit --filter=map file orig.img map=0-511:512 map=512-1023:0

PARAMETERS

map=START-END:DEST
    Map bytes in the range "START" to "END" (inclusive) to "DEST" in the underlying plugin. The destination range ends at:

     DEST_END = DEST+END-START

    This means that when the byte at offset "START" is read or written (or any other operation such as trim), the request is redirected to the byte at offset "DEST" in the underlying plugin, and so on for the following bytes up to and including offset "END" which is mapped to "DEST_END".

    "DEST" through to "DEST_END" must exist in the underlying plugin. Attempts to map requests beyond the end of the underlying plugin will return I/O errors.

    You can give this parameter multiple times. If overlapping ranges are described then the first matching range on the command line takes precedence. There is an implicit 1-1 mapping covering parts of the disk not covered by explicit "map" parameters.

    If you have a large number of mappings, consider using the nbdkit @PATH parameter to read them from an external file (see "@PATH" in nbdkit(1)).

map-size=SIZE
    If this parameter is set, the size of the disk is set to "SIZE". Note if "SIZE" is larger than the underlying plugin then you must map areas of the disk beyond the plugin up to "SIZE", otherwise accesses will return I/O errors.

    If this parameter is not set, the size of the underlying plugin is used.

FILES

$filterdir/nbdkit-map-filter.so
    The filter.

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

VERSION
"nbdkit-map-filter" first appeared in nbdkit 1.46.

SEE ALSO
nbdkit(1), nbdkit-extentlist-filter(1), nbdkit-offset-filter(1), nbdkit-partition-filter(1), nbdkit-protect-filter(1), nbdkit-truncate-filter(1), nbdkit-filter(3).

AUTHORS
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.