nbdkit-cow-filter man page

nbdkit-cow-filter — nbdkit copy-on-write (COW) filter

Synopsis

 nbdkit --filter=cow plugin [plugin-args...]

Description

nbdkit-cow-filter is a filter that makes a temporary writable copy on top of a read-only plugin.  It can be used to enable writes for plugins which only implement read-only access.  Note that:

Limitations of the filter include:

Parameters

cow-on-cache=true

Treat a client cache request as a shortcut for copying unmodified data from the plugin to the overlay, rather than the default of passing cache requests on to the plugin. This parameter defaults to false (which leaves the overlay as small as possible), but setting it can be useful for converting cache commands into a form of copy-on-read behavior, in addition to the filter's normal copy-on-write semantics.

Examples

Serve the file disk.img, allowing writes, but do not save any changes into the file:

 nbdkit --filter=cow file disk.img

nbdkit-xz-plugin(1) only supports read access, but you can provide temporary write access by doing (although this does not save changes to the file):

 nbdkit --filter=cow xz disk.xz

Creating a Diff with Qemu-Img

Although nbdkit-cow-filter itself cannot save the differences, it is possible to do this using an obscure feature of qemu-img(1). nbdkit must remain continuously running during the whole operation, otherwise all changes will be lost.

Run nbdkit:

 nbdkit --filter=cow file disk.img

and then connect with a client and make whatever changes you need. At the end, disconnect the client.

Run these qemu-img commands to construct a qcow2 file containing the differences:

 qemu-img create -f qcow2 -b nbd:localhost diff.qcow2
 qemu-img rebase -b disk.img diff.qcow2

diff.qcow2 now contains the differences between the base (disk.img) and the changes stored in nbdkit-cow-filter.  nbdkit can now be killed.

Environment Variables

TMPDIR

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

Files

$filterdir/nbdkit-cow-filter.so

The filter.

Use nbdkit --dump-config to find the location of $filterdir.

Version

nbdkit-cow-filter first appeared in nbdkit 1.2.

See Also

nbdkit(1), nbdkit-file-plugin(1), nbdkit-xz-plugin(1), nbdkit-truncate-filter(1), nbdkit-filter(3), qemu-img(1).

Authors

Eric Blake

Richard W.M. Jones

License

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Referenced By

nbdkit(1), nbdkit-filter(3), nbdkit-info-plugin(1), nbdkit-linuxdisk-plugin(1), nbdkit-log-filter(1), nbdkit-release-notes-1.10(1), nbdkit-release-notes-1.14(1), nbdkit-truncate-filter(1).

2020-03-20 nbdkit-1.19.4 NBDKIT