3 nbdkit-truncate-filter - change the size of plugins
7 nbdkit --filter=truncate plugin [truncate=SIZE]
8 [round-up=N] [round-down=N]
12 C<nbdkit-truncate-filter> is a filter that changes the size of
13 the underlying plugin. It can:
19 Make the plugin smaller (truncate it). Use the C<truncate=SIZE>
20 parameter to set the smaller size.
24 Make the plugin larger (the additional bytes read back as zeroes).
25 Use C<truncate=SIZE> to set the larger size.
29 Round the size of the plugin up or down to the next multiple of C<N>.
30 Use either C<round-up=N> or C<round-down=N>.
34 A common use for this filter is to handle NBD clients which have a
35 problem dealing with device sizes which are not a multiple of 512
36 bytes. Use C<round-up=512> to round the size up to the next multiple
37 of 512 bytes. If the size is already a multiple of 512 bytes then
44 =item B<truncate=>SIZE
46 Set the absolute size in bytes of the apparent device. This may be
47 smaller or larger or the same as the underlying plugin.
49 If the size is larger than the underlying plugin, reading the extra
50 space returns zeroes. Writes are also permitted to the extra space,
51 but you must only write zeroes (any attempts to write non-zero bytes
52 will return an error back to the client).
54 This parameter is optional.
58 Round the size up to the next multiple of C<N> bytes. If the size of
59 the underlying plugin is already a multiple of C<N> bytes, this has no
62 This option is useful when combined with other filters (such as
63 L<nbdkit-blocksize-filter(1)>) that normally round down due to a
64 larger granularity, in order to access the last few bytes of a file
65 that would otherwise be rendered inaccessible.
67 This parameter is optional.
71 Round the size down to a multiple of C<N> bytes. If the size of the
72 underlying plugin is already a multiple of C<N> bytes, this has no
75 This parameter is optional.
81 Serve a file as if it were a block device that insists on 4k
82 alignment, while still allowing access to any unaligned bytes at the
85 nbdkit --filter=blocksize --filter=truncate file /path/to/file \
86 minblock=4k round-up=4k
92 =item F<$filterdir/nbdkit-truncate-filter.so>
96 Use C<nbdkit --dump-config> to find the location of C<$filterdir>.
102 C<nbdkit-truncate-filter> first appeared in nbdkit 1.6.
107 L<nbdkit-file-plugin(1)>,
109 L<nbdkit-blocksize-filter(1)>,
110 L<nbdkit-cache-filter(1)>,
111 L<nbdkit-cow-filter(1)>,
112 L<nbdkit-offset-filter(1)>,
113 L<nbdkit-partition-filter(1)>.