3 nbdkit-blocksize-filter - nbdkit blocksize filter
7 nbdkit --filter=blocksize plugin [minblock=SIZE] [maxdata=SIZE] \
8 [maxlen=SIZE] [plugin-args...]
12 C<nbdkit-blocksize-filter> is a filter that ensures various block size
13 limits are met on transactions presented to the plugin. The NBD
14 protocol permits clients to send requests with a granularity as small
15 as 1 byte or as large as nearly 4 gigabytes, although it suggests that
16 portable clients should align requests to 512 bytes and not exceed 32
17 megabytes without prior coordination with the server.
19 Meanwhile, some plugins require requests to be aligned to 512-byte
20 multiples, or may enforce a maximum transaction size to bound the time
21 or memory resources spent by any one command (note that nbdkit itself
22 refuses a read or write larger than 64 megabytes, while many other NBD
23 servers limit things to 32 megabytes). The blocksize filter can be
24 used to modify the client requests to meet the plugin restrictions.
28 The nbdkit-blocksize-filter accepts the following parameters.
32 =item B<minblock=>SIZE
34 The minimum block size and alignment to pass to the plugin. This must
35 be a power of two, and no larger than 64k. If omitted, this defaults
36 to 1 (that is, no minimum size restrictions). The filter rounds up
37 read requests to alignment boundaries, performs read-modify-write
38 cycles for any unaligned head or tail of a write or zero request, and
39 silently ignores any unaligned head or tail of a trim request. The
40 filter also truncates the plugin size down to an aligned value (as it
41 cannot safely operate on the unaligned tail). If you need to round
42 the image size up instead to access the last few bytes, combine this
43 filter with L<nbdkit-truncate-filter(1)>.
45 This parameter understands the suffix 'k' for 1024.
49 The maximum block size for any single transaction with data (read and
50 write). If omitted, this defaults to 64 megabytes (that is, the
51 nbdkit maximum). This need not be a power of two, but must be an
52 integer multiple of C<minblock>. The filter fragments any larger
53 client request into multiple plugin requests.
55 This parameter understands the suffixes 'k', 'M', and 'G' for powers
60 The maximum length for any single transaction without data (trim, zero
61 or extents). If omitted, this defaults to 0xffffffff rounded down to
62 C<minsize> alignment (that is, the inherent 32-bit limit of the NBD
63 protocol). This need not be a power of two, but must be an integer
64 multiple of C<minblock>, and should be at least as large as
65 C<maxdata>. The filter fragments any larger client request into
66 multiple plugin requests.
68 This parameter understands the suffixes 'k', 'M', and 'G' for powers
75 Allow an arbitrary client to use the VDDK plugin (which is limited to
76 512-byte blocks), without having to fix the client to avoid sending
79 nbdkit --filter=blocksize vddk minblock=512 file=/absolute/path/to/file.vmdk
81 Allow an arbitrary client tuned to nbdkit's 64 megabyte sizing to
82 connect to a remote server that insists on 32 megabyte sizing, via the
85 nbdkit --filter=blocksize nbd maxdata=32M socket=/path/to/socket
87 Serve a file as if it were a block device that insists on 4k
88 alignment, while still allowing access to any unaligned bytes at the
91 nbdkit --filter=blocksize --filter=truncate file /path/to/file \
92 minblock=4k round-up=4k
98 =item F<$filterdir/nbdkit-blocksize-filter.so>
102 Use C<nbdkit --dump-config> to find the location of C<$filterdir>.
108 C<nbdkit-blocksize-filter> first appeared in nbdkit 1.4.
113 L<nbdkit-nbd-plugin(1)>,
114 L<nbdkit-vddk-plugin(1)>,
116 L<nbdkit-truncate-filter(1)>.
124 Copyright (C) 2018 Red Hat Inc.