1nbdkit-file-plugin(1)               NBDKIT               nbdkit-file-plugin(1)
2
3
4

NAME

6       nbdkit-file-plugin - nbdkit file plugin
7

SYNOPSIS

9        nbdkit file [file=]FILENAME
10                    [cache=default|none] [fadvise=normal|random|sequential]
11
12        nbdkit file dir=DIRECTORY
13

DESCRIPTION

15       "nbdkit-file-plugin" is a file serving plugin for nbdkit(1).
16
17       It serves the named "FILENAME" over NBD.  Local block devices (eg.
18       /dev/sda) may also be served.
19
20       If you use the "dir" parameter the plugin works in a different mode
21       where it serves files from the given "DIRECTORY", chosen by the client
22       using the NBD export name.
23

PARAMETERS

25       Either file or dir must be given which controls the mode of the plugin,
26       either serving a single file or the files in a directory.
27
28       cache=default
29       cache=none
30           (nbdkit ≥ 1.22, not Windows)
31
32           Using "cache=none" tries to prevent the kernel from keeping parts
33           of the file that have already been read or written in the page
34           cache.
35
36       dir=DIRECTORY
37           (nbdkit ≥ 1.22, not Windows)
38
39           Serve all regular files and block devices located directly inside
40           the directory named "DIRECTORY", including those found by following
41           symbolic links.  Other special files in the directory (such as
42           subdirectories, pipes, or Unix sockets) are ignored.
43
44           When this mode is used, the file to be served is chosen by the
45           export name passed by the client, where the client can request a
46           list of available exports using NBD_OPT_LIST.  A client that
47           requests the default export ("") will be rejected.  However, you
48           can use nbdkit-exportname-filter(1) to adjust what export names the
49           client sees or uses as a default.  For security, when using
50           directory mode, this plugin will not accept export names containing
51           slash ("/").
52
53       fadvise=normal
54       fadvise=random
55       fadvise=sequential
56           (nbdkit ≥ 1.22, not Windows)
57
58           This optional flag hints to the kernel that you will access the
59           file normally, or in a random order, or sequentially.  The exact
60           behaviour depends on your operating system, but for Linux using
61           "normal" causes the kernel to read-ahead, "sequential" causes the
62           kernel to read-ahead twice as much as "normal", and "random" turns
63           off read-ahead.  See also posix_fadvise(2).
64
65           The default is "normal".
66
67       [file=]FILENAME
68           Serve the file named "FILENAME".  A local block device name can
69           also be used here.  When this mode is used, the export name
70           requested by the client is ignored.
71
72           "file=" is a magic config key and may be omitted in most cases.
73           See "Magic parameters" in nbdkit(1).
74
75       [file=]\\.\C:
76       [file=]\\.\Volume
77       [file=]\\.\PhysicalDiskN
78       [file=]\\.\CdRomN
79           (Windows only)
80
81           Serve the Windows volume specified by the device name.  See:
82           https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#win32-device-namespaces.
83

NOTES

85   Optimizing for random or sequential access
86       If you know in advance that the NBD client will access the file
87       randomly or only sequentially then you can hint that to the kernel
88       using:
89
90        nbdkit file disk.img fadvise=random
91        nbdkit file disk.img fadvise=sequential
92
93       As described in the "PARAMETERS" section above, on Linux this disables
94       or increases the amount of read-ahead that the kernel does.
95
96   Reducing evictions from the page cache
97       If the file is very large and you know the client will only read/write
98       the file sequentially one time (eg for making a single copy or backup)
99       then this will stop other processes from being evicted from the page
100       cache:
101
102        nbdkit file disk.img fadvise=sequential cache=none
103
104   Files on tmpfs
105       If you want to expose a file that resides on a file system known to
106       have poor lseek(2) performance when searching for holes ("tmpfs" is
107       known to be one such file system), you can use
108       nbdkit-noextents-filter(1) to avoid the penalty of probing for holes.
109
110   Plugin --dump-plugin output
111       You can obtain extra information about how the file plugin was compiled
112       by doing:
113
114        nbdkit file --dump-plugin
115
116       Some of the fields which may appear are listed below.  Note these are
117       for information only and may be changed or removed at any time in the
118       future.
119
120       "file_blksszget=yes"
121       "file_blkzeroout=yes"
122           If both set, the plugin may be able to efficiently zero ranges of
123           block devices, where the driver and block device itself supports
124           this.
125
126       "file_falloc_fl_punch_hole=yes"
127           If set, the plugin may be able to punch holes (make sparse) files
128           and block devices.
129
130       "file_falloc_fl_zero_range=yes"
131           If set, the plugin may be able to efficiently zero ranges of files
132           and block devices.
133
134       "winfile=yes"
135           If present, this is the Windows version of the file plugin with
136           reduced functionality and some special Windows-only features, as
137           noted in this manual.
138
139   Windows sparse files
140       This plugin supports sparse files on Windows (with hole punching).
141       However for this to work the files must already have the sparse
142       property, the plugin will not make existing files sparse.  Use the
143       "fsutil sparse" command to control the sparseness property of files.
144
145   Old "rdelay" and "wdelay" parameters.
146       Before nbdkit supported filters (< 1.2) this plugin had extra
147       parameters "rdelay" and "wdelay" to insert delays.  These parameters
148       have been moved to nbdkit-delay-filter(1).  Modify the command line to
149       add --filter=delay in order to use these parameters.
150
151   Concatenating files
152       To concatenate and export multiple files, use nbdkit-split-plugin(1).
153

DEBUG FLAG

155       -D file.zero=1
156           This enables very verbose debugging of the NBD zero request.  This
157           can be used to tell if the file plugin is able to zero ranges in
158           the file or block device efficiently or not.
159

FILES

161       $plugindir/nbdkit-file-plugin.so
162           The plugin.
163
164           Use "nbdkit --dump-config" to find the location of $plugindir.
165

VERSION

167       "nbdkit-file-plugin" first appeared in nbdkit 1.0.
168

SEE ALSO

170       nbdkit(1), nbdkit-plugin(3), nbdkit-split-plugin(1),
171       nbdkit-partitioning-plugin(1), nbdkit-tmpdisk-plugin(1),
172       nbdkit-exportname-filter(1), nbdkit-fua-filter(1),
173       nbdkit-noextents-filter(1).
174

AUTHORS

176       Eric Blake
177
178       Nir Soffer
179
180       Richard W.M. Jones
181
183       Copyright (C) 2013-2020 Red Hat Inc.
184

LICENSE

186       Redistribution and use in source and binary forms, with or without
187       modification, are permitted provided that the following conditions are
188       met:
189
190       •   Redistributions of source code must retain the above copyright
191           notice, this list of conditions and the following disclaimer.
192
193       •   Redistributions in binary form must reproduce the above copyright
194           notice, this list of conditions and the following disclaimer in the
195           documentation and/or other materials provided with the
196           distribution.
197
198       •   Neither the name of Red Hat nor the names of its contributors may
199           be used to endorse or promote products derived from this software
200           without specific prior written permission.
201
202       THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
203       EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
204       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
205       PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
206       LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
207       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
208       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
209       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
210       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
211       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
212       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
213
214
215
216nbdkit-1.25.8                     2021-05-25             nbdkit-file-plugin(1)
Impressum