.\" Automatically generated by Podwrapper::Man 1.24.1 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "nbdkit-file-plugin 1" .TH nbdkit-file-plugin 1 "2021-01-20" "nbdkit-1.24.1" "NBDKIT" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" nbdkit\-file\-plugin \- nbdkit file plugin .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& nbdkit file [file=]FILENAME \& [cache=default|none] [fadvise=normal|random|sequential] \& \& nbdkit file dir=DIRNAME .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`nbdkit\-file\-plugin\*(C'\fR is a file serving plugin for \fBnbdkit\fR\|(1). .PP It serves the named \f(CW\*(C`FILENAME\*(C'\fR over \s-1NBD.\s0 Local block devices (eg. \fI/dev/sda\fR) may also be served. It may also be used to serve any file within a given \f(CW\*(C`DIRECTORY\*(C'\fR, according to which export name the guest requests. .SH "PARAMETERS" .IX Header "PARAMETERS" One of \fBfile\fR or \fBdir\fR must be given to determine which mode the server will use. .IP "\fBcache=default\fR" 4 .IX Item "cache=default" .PD 0 .IP "\fBcache=none\fR" 4 .IX Item "cache=none" .PD (nbdkit ≥ 1.22, not Windows) .Sp Using \f(CW\*(C`cache=none\*(C'\fR tries to prevent the kernel from keeping parts of the file that have already been read or written in the page cache. .IP "\fBfadvise=normal\fR" 4 .IX Item "fadvise=normal" .PD 0 .IP "\fBfadvise=random\fR" 4 .IX Item "fadvise=random" .IP "\fBfadvise=sequential\fR" 4 .IX Item "fadvise=sequential" .PD (nbdkit ≥ 1.22, not Windows) .Sp This optional flag hints to the kernel that you will access the file normally, or in a random order, or sequentially. The exact behaviour depends on your operating system, but for Linux using \f(CW\*(C`normal\*(C'\fR causes the kernel to read-ahead, \f(CW\*(C`sequential\*(C'\fR causes the kernel to read-ahead twice as much as \f(CW\*(C`normal\*(C'\fR, and \f(CW\*(C`random\*(C'\fR turns off read-ahead. See also \fBposix_fadvise\fR\|(2). .Sp The default is \f(CW\*(C`normal\*(C'\fR. .IP "[\fBfile=\fR]FILENAME" 4 .IX Item "[file=]FILENAME" Serve the file named \f(CW\*(C`FILENAME\*(C'\fR. A local block device name can also be used here. When this mode is used, the export name requested by the client is ignored. .Sp \&\f(CW\*(C`file=\*(C'\fR is a magic config key and may be omitted in most cases. See \*(L"Magic parameters\*(R" in \fBnbdkit\fR\|(1). .IP "[\fBfile=\fR]\fB\e\e.\e\fRC\fB:\fR" 4 .IX Item "[file=].C:" .PD 0 .IP "[\fBfile=\fR]\fB\e\e.\e\fRVolume" 4 .IX Item "[file=].Volume" .IP "[\fBfile=\fR]\fB\e\e.\ePhysicalDisk\fR\fIN\fR" 4 .IX Item "[file=].PhysicalDiskN" .IP "[\fBfile=\fR]\fB\e\e.\eCdRom\fR\fIN\fR" 4 .IX Item "[file=].CdRomN" .PD (Windows only) .Sp Serve the Windows volume specified by the device name. See: https://docs.microsoft.com/en\-us/windows/win32/fileio/naming\-a\-file#win32\-device\-namespaces. .IP "\fBdir=\fR\s-1DIRNAME\s0" 4 .IX Item "dir=DIRNAME" (nbdkit ≥ 1.22, not Windows) .Sp Serve all regular files and block devices located directly within the directory named \f(CW\*(C`DIRNAME\*(C'\fR, including those found by following symbolic links. Other special files in the directory (such as subdirectories, fifos, or Unix sockets) are ignored. When this mode is used, the file to be served is chosen by the export name passed by the client, where the client can request a list of available exports using \s-1NBD_OPT_LIST.\s0 A client that requests the default export (\f(CW""\fR) will be rejected. However, you can use \fBnbdkit\-exportname\-filter\fR\|(1) to adjust what export names the client sees or uses as a default. For security, when using directory mode, this plugin will not accept export names containing slash (\f(CW\*(C`/\*(C'\fR). .SH "NOTES" .IX Header "NOTES" .SS "Optimizing for random or sequential access" .IX Subsection "Optimizing for random or sequential access" If you know in advance that the \s-1NBD\s0 client will access the file randomly or only sequentially then you can hint that to the kernel using: .PP .Vb 2 \& nbdkit file disk.img fadvise=random \& nbdkit file disk.img fadvise=sequential .Ve .PP As described in the \*(L"\s-1PARAMETERS\*(R"\s0 section above, on Linux this disables or increases the amount of read-ahead that the kernel does. .SS "Reducing evictions from the page cache" .IX Subsection "Reducing evictions from the page cache" If the file is very large and you know the client will only read/write the file sequentially one time (eg for making a single copy or backup) then this will stop other processes from being evicted from the page cache: .PP .Vb 1 \& nbdkit file disk.img fadvise=sequential cache=none .Ve .SS "Files on tmpfs" .IX Subsection "Files on tmpfs" If you want to expose a file that resides on a file system known to have poor \f(CWlseek(2)\fR performance when searching for holes (\f(CW\*(C`tmpfs\*(C'\fR is known to be one such file system), you can use \&\fBnbdkit\-noextents\-filter\fR\|(1) to avoid the penalty of probing for holes. .SS "Plugin \fI\-\-dump\-plugin\fP output" .IX Subsection "Plugin --dump-plugin output" You can obtain extra information about how the file plugin was compiled by doing: .PP .Vb 1 \& nbdkit file \-\-dump\-plugin .Ve .PP Some of the fields which may appear are listed below. Note these are for information only and may be changed or removed at any time in the future. .ie n .IP """file_blksszget=yes""" 4 .el .IP "\f(CWfile_blksszget=yes\fR" 4 .IX Item "file_blksszget=yes" .PD 0 .ie n .IP """file_blkzeroout=yes""" 4 .el .IP "\f(CWfile_blkzeroout=yes\fR" 4 .IX Item "file_blkzeroout=yes" .PD If both set, the plugin may be able to efficiently zero ranges of block devices, where the driver and block device itself supports this. .ie n .IP """file_falloc_fl_punch_hole=yes""" 4 .el .IP "\f(CWfile_falloc_fl_punch_hole=yes\fR" 4 .IX Item "file_falloc_fl_punch_hole=yes" If set, the plugin may be able to punch holes (make sparse) files and block devices. .ie n .IP """file_falloc_fl_zero_range=yes""" 4 .el .IP "\f(CWfile_falloc_fl_zero_range=yes\fR" 4 .IX Item "file_falloc_fl_zero_range=yes" If set, the plugin may be able to efficiently zero ranges of files and block devices. .ie n .IP """winfile=yes""" 4 .el .IP "\f(CWwinfile=yes\fR" 4 .IX Item "winfile=yes" If present, this is the Windows version of the file plugin which lacks certain features as noted in this manual. .SS "Windows sparse files" .IX Subsection "Windows sparse files" This plugin supports sparse files on Windows (with hole punching). However for this to work the files must already have the sparse property, the plugin will not make existing files sparse. Use the \&\f(CW\*(C`fsutil sparse\*(C'\fR command to control the sparseness property of files. .ie n .SS "Old ""rdelay"" and ""wdelay"" parameters." .el .SS "Old \f(CWrdelay\fP and \f(CWwdelay\fP parameters." .IX Subsection "Old rdelay and wdelay parameters." Before nbdkit supported filters (< 1.2) this plugin had extra parameters \f(CW\*(C`rdelay\*(C'\fR and \f(CW\*(C`wdelay\*(C'\fR to insert delays. These parameters have been moved to \fBnbdkit\-delay\-filter\fR\|(1). Modify the command line to add \fI\-\-filter=delay\fR in order to use these parameters. .SS "Concatenating files" .IX Subsection "Concatenating files" To concatenate and export multiple files, use \&\fBnbdkit\-split\-plugin\fR\|(1). .SH "DEBUG FLAG" .IX Header "DEBUG FLAG" .IP "\fB\-D file.zero=1\fR" 4 .IX Item "-D file.zero=1" This enables very verbose debugging of the \s-1NBD\s0 zero request. This can be used to tell if the file plugin is able to zero ranges in the file or block device efficiently or not. .SH "FILES" .IX Header "FILES" .IP "\fI\f(CI$plugindir\fI/nbdkit\-file\-plugin.so\fR" 4 .IX Item "$plugindir/nbdkit-file-plugin.so" The plugin. .Sp Use \f(CW\*(C`nbdkit \-\-dump\-config\*(C'\fR to find the location of \f(CW$plugindir\fR. .SH "VERSION" .IX Header "VERSION" \&\f(CW\*(C`nbdkit\-file\-plugin\*(C'\fR first appeared in nbdkit 1.0. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBnbdkit\fR\|(1), \&\fBnbdkit\-plugin\fR\|(3), \&\fBnbdkit\-split\-plugin\fR\|(1), \&\fBnbdkit\-partitioning\-plugin\fR\|(1), \&\fBnbdkit\-tmpdisk\-plugin\fR\|(1), \&\fBnbdkit\-exportname\-filter\fR\|(1), \&\fBnbdkit\-fua\-filter\fR\|(1), \&\fBnbdkit\-noextents\-filter\fR\|(1). .SH "AUTHORS" .IX Header "AUTHORS" Eric Blake .PP Nir Soffer .PP Richard W.M. Jones .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2013\-2020 Red Hat Inc. .SH "LICENSE" .IX Header "LICENSE" Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: .IP "\(bu" 4 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. .IP "\(bu" 4 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. .IP "\(bu" 4 Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. .PP \&\s-1THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS\s0 ''\s-1AS IS\s0'' \s-1AND 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\s0 (\s-1INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES\s0; \s-1LOSS OF USE, DATA, OR PROFITS\s0; \s-1OR BUSINESS INTERRUPTION\s0) \s-1HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\s0 (\s-1INCLUDING NEGLIGENCE OR OTHERWISE\s0) \s-1ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\s0