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
27       This filter can be combined with nbdkit-blocksize-policy-filter(1) to
28       advertise different block sizes to the client.
29

PARAMETERS

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

EXAMPLES

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

FILES

92       $filterdir/nbdkit-blocksize-filter.so
93           The filter.
94
95           Use "nbdkit --dump-config" to find the location of $filterdir.
96

VERSION

98       "nbdkit-blocksize-filter" first appeared in nbdkit 1.4.
99

SEE ALSO

101       nbdkit(1), nbdkit-nbd-plugin(1), nbdkit-vddk-plugin(1),
102       nbdkit-filter(3), nbdkit-blocksize-policy-filter(1),
103       nbdkit-truncate-filter(1).
104

AUTHORS

106       Eric Blake
107
109       Copyright (C) 2018-2022 Red Hat Inc.
110

LICENSE

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