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

NAME

6       nbdkit-truncate-filter - change the size of plugins
7

SYNOPSIS

9        nbdkit --filter=truncate plugin [truncate=SIZE]
10                                        [round-up=N] [round-down=N]
11

DESCRIPTION

13       "nbdkit-truncate-filter" is a filter that changes the size of the
14       underlying plugin.  It can:
15
16       •   Make the plugin smaller (truncate it).  Use the "truncate=SIZE"
17           parameter to set the smaller size.
18
19       •   Make the plugin larger (the additional bytes read back as zeroes).
20           Use "truncate=SIZE" to set the larger size.
21
22       •   Round the size of the plugin up or down to the next multiple of
23           "N".  Use either "round-up=N" or "round-down=N".
24
25       A common use for this filter is to handle NBD clients which have a
26       problem dealing with device sizes which are not a multiple of 512
27       bytes.  Use "round-up=512" to round the size up to the next multiple of
28       512 bytes.  If the size is already a multiple of 512 bytes then this
29       has no effect.
30

PARAMETERS

32       truncate=SIZE
33           Set the absolute size in bytes of the apparent device.  This may be
34           smaller or larger or the same as the underlying plugin.
35
36           If the size is larger than the underlying plugin, reading the extra
37           space returns zeroes.  Writes are also permitted to the extra
38           space, but you must only write zeroes (any attempts to write non-
39           zero bytes will return an error back to the client).
40
41           This parameter is optional.
42
43       round-up=N
44           Round the size up to the next multiple of "N" bytes.  If the size
45           of the underlying plugin is already a multiple of "N" bytes, this
46           has no effect.
47
48           This option is useful when combined with other filters (such as
49           nbdkit-blocksize-filter(1)) that normally round down due to a
50           larger granularity, in order to access the last few bytes of a file
51           that would otherwise be rendered inaccessible.
52
53           This parameter is optional.
54
55       round-down=N
56           Round the size down to a multiple of "N" bytes.  If the size of the
57           underlying plugin is already a multiple of "N" bytes, this has no
58           effect.
59
60           This parameter is optional.
61

EXAMPLES

63       Serve a file as if it were a block device that insists on 4k alignment,
64       while still allowing access to any unaligned bytes at the end of the
65       file:
66
67        nbdkit --filter=blocksize --filter=truncate file /path/to/file \
68        minblock=4k round-up=4k
69

FILES

71       $filterdir/nbdkit-truncate-filter.so
72           The filter.
73
74           Use "nbdkit --dump-config" to find the location of $filterdir.
75

VERSION

77       "nbdkit-truncate-filter" first appeared in nbdkit 1.6.
78

SEE ALSO

80       nbdkit(1), nbdkit-file-plugin(1), nbdkit-filter(3),
81       nbdkit-blocksize-filter(1), nbdkit-cache-filter(1),
82       nbdkit-cow-filter(1), nbdkit-offset-filter(1),
83       nbdkit-partition-filter(1).
84

AUTHORS

86       Richard W.M. Jones
87
89       Copyright (C) 2018 Red Hat Inc.
90

LICENSE

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