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

NAME

6       nbdkit-cow-filter - nbdkit copy-on-write (COW) filter
7

SYNOPSIS

9        nbdkit --filter=cow plugin [plugin-args...]
10                                   [cow-block-size=N]
11                                   [cow-on-cache=false|true]
12                                   [cow-on-read=false|true|/PATH]
13

DESCRIPTION

15       "nbdkit-cow-filter" is a filter that makes a temporary writable copy on
16       top of a plugin.  It can also be used to enable writes for plugins
17       which are read-only.
18
19       The underlying plugin is opened read-only.  This filter does not pass
20       any writes or write-like operations (like trim and zero) through to the
21       underlying plugin.
22
23       Note that anything written is thrown away as soon as nbdkit exits.  If
24       you want to save changes, either copy out the whole disk using a tool
25       like nbdcopy(1), or use the method described in "NOTES" below to create
26       a diff.
27
28       Limitations of the filter include:
29
30       •   The underlying file/device must not be resized.
31
32       •   The underlying plugin must behave “normally”, meaning that it must
33           serve the same data to each client.
34

PARAMETERS

36       cow-block-size=N
37           Set the block size used by the filter.  This has to be a power of
38           two and the minimum block size is 4K.  The maximum block size
39           depends on the plugin, but a block size larger than a few megabytes
40           is not usually a good idea.
41
42           The default is 64K.
43
44       cow-on-cache=false
45           Do not save data from cache (prefetch) requests in the overlay.
46           This leaves the overlay as small as possible.  This is the default.
47
48       cow-on-cache=true
49           When the client issues a cache (prefetch) request, preemptively
50           save the data from the plugin into the overlay.
51
52       cow-on-read=false
53           Do not save data from read requests in the overlay.  This leaves
54           the overlay as small as possible.  This is the default.
55
56       cow-on-read=true
57           When the client issues a read request, copy the data into the
58           overlay so that the same data can be served more quickly later.
59
60       cow-on-read=/PATH
61           When /PATH (which must be an absolute path) exists, this behaves
62           like "cow-on-read=true", and when it does not exist like
63           "cow-on-read=false".  This allows you to control the "cow-on-read"
64           behaviour while nbdkit is running.
65

EXAMPLES

67   nbdkit --filter=cow file disk.img
68       Serve the file disk.img, allowing writes, but do not save any changes
69       into the file.
70
71   nbdkit --filter=cow --filter=xz file disk.xz cow-on-read=true
72       nbdkit-xz-filter(1) only supports read access, but you can provide
73       temporary write access by using the command above.  Because xz
74       decompression is slow, using "cow-on-read=true" causes reads to be
75       cached as well as writes, improving performance at the expense of using
76       more temporary space.  Note that writes are thrown away when nbdkit
77       exits and do not get saved into the file.
78

NOTES

80   Creating a diff with qemu-img
81       Although nbdkit-cow-filter itself cannot save the differences, it is
82       possible to do this using an obscure feature of qemu-img(1).  nbdkit
83       must remain continuously running during the whole operation, otherwise
84       all changes will be lost.
85
86       Run nbdkit:
87
88        nbdkit --filter=cow file disk.img
89
90       and then connect with a client and make whatever changes you need.  At
91       the end, disconnect the client.
92
93       Run these "qemu-img" commands to construct a qcow2 file containing the
94       differences:
95
96        qemu-img create -F raw -b nbd:localhost -f qcow2 diff.qcow2
97        qemu-img rebase -F raw -b disk.img -f qcow2 diff.qcow2
98
99       diff.qcow2 now contains the differences between the base (disk.img) and
100       the changes stored in nbdkit-cow-filter.  "nbdkit" can now be killed.
101
102   Compared to nbd-server -c option
103       All connections to the nbdkit instance see the same view of the disk.
104       This is different from nbd-server(1) -c option where each connection
105       sees its own copy-on-write overlay and simply disconnecting the client
106       throws that away.  It also allows us to create diffs as above.
107

ENVIRONMENT VARIABLES

109       "TMPDIR"
110           The copy-on-write changes are stored in a temporary file located in
111           /var/tmp by default.  You can override this location by setting the
112           "TMPDIR" environment variable before starting nbdkit.
113

FILES

115       $filterdir/nbdkit-cow-filter.so
116           The filter.
117
118           Use "nbdkit --dump-config" to find the location of $filterdir.
119

VERSION

121       "nbdkit-cow-filter" first appeared in nbdkit 1.2.
122

SEE ALSO

124       nbdkit(1), nbdkit-file-plugin(1), nbdkit-cache-filter(1),
125       nbdkit-cacheextents-filter(1), nbdkit-xz-filter(1), nbdkit-filter(3),
126       nbdcopy(1), qemu-img(1).
127

AUTHORS

129       Eric Blake
130
131       Richard W.M. Jones
132
134       Copyright Red Hat
135

LICENSE

137       Redistribution and use in source and binary forms, with or without
138       modification, are permitted provided that the following conditions are
139       met:
140
141       •   Redistributions of source code must retain the above copyright
142           notice, this list of conditions and the following disclaimer.
143
144       •   Redistributions in binary form must reproduce the above copyright
145           notice, this list of conditions and the following disclaimer in the
146           documentation and/or other materials provided with the
147           distribution.
148
149       •   Neither the name of Red Hat nor the names of its contributors may
150           be used to endorse or promote products derived from this software
151           without specific prior written permission.
152
153       THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
154       EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
155       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
156       PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
157       LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
158       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
159       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
160       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
161       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
162       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
163       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
164
165
166
167nbdkit-1.36.2                     2023-11-26              nbdkit-cow-filter(1)
Impressum