1nbdkit-blocksize-filter(1)          NBDKIT          nbdkit-blocksize-filter(1)
2
3
4

NAME

6       nbdkit-blocksize-filter - nbdkit blocksize filter
7

SYNOPSIS

9        nbdkit --filter=blocksize plugin [minblock=SIZE] [maxdata=SIZE] \
10            [maxlen=SIZE] [plugin-args...]
11

DESCRIPTION

13       "nbdkit-blocksize-filter" is a filter that ensures various block size
14       limits are met on transactions presented to the plugin.  The NBD
15       protocol permits clients to send requests with a granularity as small
16       as 1 byte or as large as nearly 4 gigabytes, although it suggests that
17       portable clients should align requests to 512 bytes and not exceed 32
18       megabytes without prior coordination with the server.
19
20       Meanwhile, some plugins require requests to be aligned to 512-byte
21       multiples, or may enforce a maximum transaction size to bound the time
22       or memory resources spent by any one command (note that nbdkit itself
23       refuses a read or write larger than 64 megabytes, while many other NBD
24       servers limit things to 32 megabytes).  The blocksize filter can be
25       used to modify the client requests to meet the plugin restrictions.
26

PARAMETERS

28       The nbdkit-blocksize-filter accepts the following parameters.
29
30       minblock=SIZE
31           The minimum block size and alignment to pass to the plugin.  This
32           must be a power of two, and no larger than 64k.  If omitted, this
33           defaults to 1 (that is, no minimum size restrictions).  The filter
34           rounds up read requests to alignment boundaries, performs read-
35           modify-write cycles for any unaligned head or tail of a write or
36           zero request, and silently ignores any unaligned head or tail of a
37           trim request.  The filter also truncates the plugin size down to an
38           aligned value (as it cannot safely operate on the unaligned tail).
39           If you need to round the image size up instead to access the last
40           few bytes, combine this filter with nbdkit-truncate-filter(1).
41
42           This parameter understands the suffix 'k' for 1024.
43
44       maxdata=SIZE
45           The maximum block size for any single transaction with data (read
46           and write).  If omitted, this defaults to 64 megabytes (that is,
47           the nbdkit maximum).  This need not be a power of two, but must be
48           an integer multiple of "minblock".  The filter fragments any larger
49           client request into multiple plugin requests.
50
51           This parameter understands the suffixes 'k', 'M', and 'G' for
52           powers of 1024.
53
54       maxlen=SIZE
55           The maximum length for any single transaction without data (trim,
56           zero or extents).  If omitted, this defaults to 0xffffffff rounded
57           down to "minsize" alignment (that is, the inherent 32-bit limit of
58           the NBD protocol).  This need not be a power of two, but must be an
59           integer multiple of "minblock", and should be at least as large as
60           "maxdata".  The filter fragments any larger client request into
61           multiple plugin requests.
62
63           This parameter understands the suffixes 'k', 'M', and 'G' for
64           powers of 1024.
65

EXAMPLES

67       Allow an arbitrary client to use the VDDK plugin (which is limited to
68       512-byte blocks), without having to fix the client to avoid sending
69       unaligned requests:
70
71        nbdkit --filter=blocksize vddk minblock=512 file=/absolute/path/to/file.vmdk
72
73       Allow an arbitrary client tuned to nbdkit's 64 megabyte sizing to
74       connect to a remote server that insists on 32 megabyte sizing, via the
75       nbd plugin:
76
77        nbdkit --filter=blocksize nbd maxdata=32M socket=/path/to/socket
78
79       Serve a file as if it were a block device that insists on 4k alignment,
80       while still allowing access to any unaligned bytes at the end of the
81       file:
82
83        nbdkit --filter=blocksize --filter=truncate file /path/to/file \
84        minblock=4k round-up=4k
85

FILES

87       $filterdir/nbdkit-blocksize-filter.so
88           The filter.
89
90           Use "nbdkit --dump-config" to find the location of $filterdir.
91

VERSION

93       "nbdkit-blocksize-filter" first appeared in nbdkit 1.4.
94

SEE ALSO

96       nbdkit(1), nbdkit-nbd-plugin(1), nbdkit-vddk-plugin(1),
97       nbdkit-filter(3), nbdkit-truncate-filter(1).
98

AUTHORS

100       Eric Blake
101
103       Copyright (C) 2018 Red Hat Inc.
104

LICENSE

106       Redistribution and use in source and binary forms, with or without
107       modification, are permitted provided that the following conditions are
108       met:
109
110       ·   Redistributions of source code must retain the above copyright
111           notice, this list of conditions and the following disclaimer.
112
113       ·   Redistributions in binary form must reproduce the above copyright
114           notice, this list of conditions and the following disclaimer in the
115           documentation and/or other materials provided with the
116           distribution.
117
118       ·   Neither the name of Red Hat nor the names of its contributors may
119           be used to endorse or promote products derived from this software
120           without specific prior written permission.
121
122       THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
123       EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
124       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
125       PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
126       LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
127       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
128       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
129       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
130       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
131       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
132       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
133
134
135
136nbdkit-1.24.2                     2021-03-02        nbdkit-blocksize-filter(1)
Impressum