nbdkit-map-filter - Man Page
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). This filter cannot change the size of the disk, use nbdkit-truncate-filter(1) to do that.
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
STARTtoEND(inclusive) toDESTin the underlying plugin. The destination range ends at:DEST_END = DEST+END-START
This means that when the byte at offset
STARTis read or written (or any other operation such as trim), the request is redirected to the byte at offsetDESTin the underlying plugin, and so on for the following bytes up to and including offsetENDwhich is mapped toDEST_END.DESTthrough toDEST_ENDmust 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
mapparameters.If you have a large number of mappings, consider using the nbdkit
@PATHparameter 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 ifSIZEis larger than the underlying plugin then you must map areas of the disk beyond the plugin up toSIZE, 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-configto 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.
Referenced By
nbdkit(1), nbdkit-filter(3), nbdkit-offset-filter(1), nbdkit-partition-filter(1), nbdkit-protect-filter(1), nbdkit-tar-filter(1), nbdkit-truncate-filter(1).