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       Only use fadvise=sequential if reading, and the reads are mainly
105       sequential.
106
107   Files on tmpfs
108       If you want to expose a file that resides on a file system known to
109       have poor lseek(2) performance when searching for holes ("tmpfs" is
110       known to be one such file system), you can use
111       nbdkit-noextents-filter(1) to avoid the penalty of probing for holes.
112
113   Plugin --dump-plugin output
114       You can obtain extra information about how the file plugin was compiled
115       by doing:
116
117        nbdkit file --dump-plugin
118
119       Some of the fields which may appear are listed below.  Note these are
120       for information only and may be changed or removed at any time in the
121       future.
122
123       "file_blksszget=yes"
124       "file_blkzeroout=yes"
125           If both set, the plugin may be able to efficiently zero ranges of
126           block devices, where the driver and block device itself supports
127           this.
128
129       "file_falloc_fl_punch_hole=yes"
130           If set, the plugin may be able to punch holes (make sparse) files
131           and block devices.
132
133       "file_falloc_fl_zero_range=yes"
134           If set, the plugin may be able to efficiently zero ranges of files
135           and block devices.
136
137       "winfile=yes"
138           If present, this is the Windows version of the file plugin with
139           reduced functionality and some special Windows-only features, as
140           noted in this manual.
141
142   Windows sparse files
143       This plugin supports sparse files on Windows (with hole punching).
144       However for this to work the files must already have the sparse
145       property, the plugin will not make existing files sparse.  Use the
146       "fsutil sparse" command to control the sparseness property of files.
147
148   Old "rdelay" and "wdelay" parameters.
149       Before nbdkit supported filters (< 1.2) this plugin had extra
150       parameters "rdelay" and "wdelay" to insert delays.  These parameters
151       have been moved to nbdkit-delay-filter(1).  Modify the command line to
152       add --filter=delay in order to use these parameters.
153
154   Concatenating files
155       To concatenate and export multiple files, use nbdkit-split-plugin(1).
156

DEBUG FLAG

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

FILES

164       $plugindir/nbdkit-file-plugin.so
165           The plugin.
166
167           Use "nbdkit --dump-config" to find the location of $plugindir.
168

VERSION

170       "nbdkit-file-plugin" first appeared in nbdkit 1.0.
171

SEE ALSO

173       nbdkit(1), nbdkit-plugin(3), nbdkit-split-plugin(1),
174       nbdkit-partitioning-plugin(1), nbdkit-tmpdisk-plugin(1),
175       nbdkit-exportname-filter(1), nbdkit-fua-filter(1),
176       nbdkit-noextents-filter(1).
177

AUTHORS

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

LICENSE

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