1 <!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
3 <!-- Process this file with docbook-to-man to generate an nroff manual
4 page: `docbook-to-man manpage.sgml > manpage.1'. You may view
5 the manual page with: `docbook-to-man manpage.sgml | nroff -man |
6 less'. A typical entry in a Makefile or Makefile.am is:
8 manpage.1: manpage.sgml
12 <!-- Fill in your name for FIRSTNAME and SURNAME. -->
13 <!ENTITY dhfirstname "<firstname>Wouter</firstname>">
14 <!ENTITY dhsurname "<surname>Verhelst</surname>">
15 <!-- Please adjust the date whenever revising the manpage. -->
16 <!ENTITY dhdate "<date>$Date: 2006-10-18 15:01:57 +0200 (wo, 18 okt 2006) $</date>">
17 <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
18 allowed: see man(7), man(1). -->
19 <!ENTITY dhsection "<manvolnum>5</manvolnum>">
20 <!ENTITY dhemail "<email>wouter@debian.org</email>">
21 <!ENTITY dhusername "Wouter Verhelst">
22 <!ENTITY dhucpackage "<refentrytitle>NBD-SERVER</refentrytitle>">
23 <!ENTITY dhpackage "/etc/nbd-server/config">
25 <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
26 <!ENTITY gnu "<acronym>GNU</acronym>">
40 <holder>&dhusername;</holder>
50 <refname>&dhpackage;</refname>
52 <refpurpose>configuration file for nbd-server</refpurpose>
56 <command>&dhpackage; </command>
61 <title>DESCRIPTION</title>
63 <para><command>&dhpackage;</command> allows to configure the
67 <filename>@sysconfdir@/nbd-server/config</filename> is the default
68 configuration file, this can be varied with the <option>-C</option>
69 option to <command>nbd-server</command>(1).
72 The configuration file consists of section header lines, comment
73 lines, and option lines.
76 A section header is a unique name that
77 is enclosed in square brackets ("[" and "]"). A section header
78 denotes the beginning of a section; a section continues until
79 the next section or the end of the file, whichever is first. The
80 first section in the configuration file must be called
81 <option>generic</option>, and is used for global options that
82 apply to more than one export. This section must always be
83 present, even if it holds no options. Every other section
84 defines one export; the names of these sections are not
85 important, except that you should take care to make sure that
86 each section name is unique (future versions of
87 <command>nbd-server</command> may use the section name to refer
91 A comment line is a line that starts with optional whitespace,
92 followed by a pound sign ("#"), and continues until the end of
93 the line. Comments may <emphasis>not</emphasis> be used on
94 option lines or section header lines.
97 An option line is a line that starts with an option name,
98 followed by an equals sign ("="), followed by the option
99 value. An option can be of type string, of type integer, or of
100 type boolean. The value of a boolean option can be denoted with
101 either true or false (so not yes, no, on, off, 1, or 0); all
102 booleans default to false unless specified otherwise; no value
103 may be quoted (always enter it directly); for a string option,
104 leading whitespace is stripped (but trailing whitespace is not).
109 <title>OPTIONS FOR SECTION [generic]</title>
111 <!-- These are in alphabetical order, please keep it that way -->
114 <term><option>group</option></term>
120 The name of the group this server must run as. If this
121 parameter is not specified, then nbd-server will not
122 attempt to change its GID (so the GID it runs as will be
123 the primary group of the user who starts nbd-server). If
124 it is specified, then nbd-server will change its GID after
125 opening ports, but before accepting connections or opening
131 <term><option>user</option></term>
137 The name of the user this server must run as. If this
138 parameter is not specified, then nbd-server will not
139 attempt to change its UID (so the UID it runs as will be
140 the user who starts nbd-server). If it is specified, then
141 nbd-server will change its UID after opening ports, but
142 before accepting connections or opening files.
149 <title>OPTIONS FOR EXPORT SECTIONS</title>
151 <!-- These are in alphabetical order, please keep it that way -->
154 <term><option>authfile</option></term>
157 Optional; string; default
158 <filename>@sysconfdir@/nbd-server/allow</filename>.
161 The name of the authorization file for this export. This
162 file should contain one line per IP-address, or per
163 network (which must be specified in CIDR-style
164 <option><replaceable>network</replaceable>/<replaceable>masklen</replaceable></option>)
165 and must not contain empty lines. If the file
166 does not exist, everyone is allowed to connect. If the
167 file exists but is empty, nobody is allowed to
168 connect. Otherwise, <command>nbd-server</command> will
169 only allow clients to connect whose IP-adres is listed in
172 <para>Corresponds to the <option>-l</option> option on the
177 <term><option>copyonwrite</option></term>
183 Whether this is a copy-on-write export. If it is, then any
184 writes to this export will not be written to the master
185 file, but to a separate file which will be removed upon
186 disconnect. The result of using this option is that
187 nbd-server will be slower, and that any writes will be
188 lost upon disconnect.
190 <para>Corresponds to the <option>-c</option> option on the
195 <term><option>exportname</option></term>
197 <para>Required; string.</para>
199 The name of the file that will be exported. This must be a
200 fully-qualified path and filename; relative paths are not
204 Note that <command>nbd-server</command> will only try to
205 find and open the exported file when a client actually
206 connects; as a result, <command>nbd-server</command> must
207 be able to open and read this file
208 <emphasis>after</emphasis> changing to the user and group
209 that have been specified by use of the
210 <option>user</option> and <option>group</option> options;
211 also, <command>nbd-server</command> will only detect
212 errors in this option upon connection of a client.
214 <para>When specified on the command line, this should be the
220 <term><option>filesize</option></term>
222 <para>Optional; integer; default autodetected.</para>
224 Disable autodetection of file or block device size, and
225 forcibly specify a size. Sizes must be specified in
226 bytes. If the <option>multifile</option> option is in
227 effect, this option specifies the size of the
228 <emphasis>entire</emphasis> export, not of individual
231 <para>When specified on the command line, this should be the
237 <term>listenaddr</term>
239 <para>Optional; string</para>
240 <para>If this option is set, it should contain the local IP
241 address (in "dotted-quad" notation) on which we should
242 listen to <command>nbd-client</command>(8) connections. If
243 it is not set, 0.0.0.0 is used (i.e., "listen on all local
244 IP addresses")</para>
248 <term><option>multifile</option></term>
250 <para>Optional; boolean.</para>
252 If this option is set to true, then
253 <command>nbd-server</command> will search for files of the
255 <replaceable>exportname</replaceable>.<replaceable>integer</replaceable>,
256 with <replaceable>exportname</replaceable> being the
257 filename that would otherwise have been used (after
258 name transformation for virtualization, if any, has been
259 performed) and <replaceable>integer</replaceable> an
260 integer number, starting with 0 and ending when no more
264 The size of the individual files will be autodetected,
265 <emphasis>even</emphasis> if the <option>filesize</option>
266 option has been specified. See the documentation for the
267 <option>multifile</option> for details.
270 Corresponds to the <option>-m</option> option on the
276 <term><option>port</option></term>
278 <para>Required; integer.</para>
280 The port on which this export is to be served. Currently
281 it is not possible to export multiple block devices on the
282 same port unless virtualization is used; future versions
283 of <command>nbd-server</command> may add this
287 When specified on the command line, this should be the
293 <term><option>readonly</option></term>
295 <para>Optional; boolean.</para>
297 Disallow writes to the device. If this option is
298 specified, <command>nbd-server</command> will issue an
299 error to any client that tries to write to the device.
302 Use of this option in conjunction with
303 <option>copyonwrite</option> is possible, but silly.
305 <para>Corresponds to the <option>-r</option> option on the
310 <term><option>sdp</option></term>
312 <para>Optional; boolean.</para>
314 When this option is enabled, <command>nbd-server</command>
315 will use the Socket Direct Protocol (SDP) to serve the
316 export, rather than just IP. This is faster, but requires
317 special hardware (usually something like InfiniBand) and
318 support in the kernel.
321 Additionally, support for this option must be enabled at
322 compile time, using the <option>--enable-sdp</option> option
323 to the <command>configure</command> script. If this option
324 is found in a configuration file and
325 <command>nbd-server</command> does not have support for SDP,
326 then <command>nbd-server</command> will exit with an error
332 <term><option>sparse_cow</option></term>
334 <para>Optional; boolean.</para>
336 When this option is enabled, <command>nbd-server</command>
337 will use sparse files to implement the copy-on-write
338 option; such files take up less space then they appear to,
339 which allows <command>nbd-server</command> to handle the
340 file as if it was just as large as the block device it's
344 If this option is disabled, <command>nbd-server</command>
345 will map every newly written block to the end of the
346 copy-on-write file, which means that
347 <command>nbd-server</command> will have to lseek(2) to the
348 right position after every 4096-byte block.
351 Using this option may be faster when much is being written
357 <term><option>timeout</option></term>
359 <para>Optional; integer; default 0</para>
361 How many seconds a connection may be idle for this
362 export. When a connection is idle for a longer time,
363 <command>nbd-server</command> will forcibly disconnect the
364 connection. If you specify 0 (the default), then a
365 connection may be idle forever.
368 Corresponds to the <option>-a</option> option on the
374 <term><option>virtstyle</option></term>
376 <para>Optional; string; default "ipliteral"</para>
378 Defines the style of virtualization. Virtualization allows
379 one to create one export that will serve a different file
380 depending on the IP address that is connecting. When
381 virtualization is There are three types of virtualization
382 that <command>nbd-server</command> supports:
386 <term><option>none</option></term>
389 No virtualization. Will attempt to open the filename
390 as it was written, even if it contains '%s' in the
396 <term><option>ipliteral</option></term>
399 <command>nbd-server</command> will look for the
400 literal string '%s' in the
401 <option>exportname</option>, and replace it by the
402 IP address of the connecting host in dotted-quad
403 notation. The string that results from this
404 transformation will be used as an absolute pathname
405 that <command>nbd-server</command> will attempt to
406 open. As an example, if a client connects from
407 192.168.1.100 and <option>exportname</option> is
408 specified as <filename>/export/%s</filename>, then
409 nbd-server will attempt to serve
410 <filename>/export/192.168.1.100</filename>
415 <term><option>iphash</option></term>
418 Same as above, except that
419 <command>nbd-server</command> will replace the dots
420 in the IP address by forward slashes ('/'); in the
421 same example, <command>nbd-server</command> would
422 open <filename>/export/192/168/1/100</filename>
428 <term><option>cidrhash</option></term>
431 This option requires one to add a space and a number
432 after it. <command>nbd-server</command> will use the
433 number as a network mask in CIDR style, and use that
434 as a hash cutoff point. In the above example, if
435 <option>virtstyle</option> has been specified as
436 <constant>cidrhash 16</constant>, then
437 <command>nbd-server</command> will try to open
438 <filename>/export/192.168.0.0/192.168.1.100</filename>;
439 if <option>virtstyle</option> were specified as
440 <constant>cidrhash 26</constant>, then
441 <command>nbd-server</command> will try to open
442 <filename>/export/192.168.1.64/192.168.1.100</filename>.
450 <term><option>prerun</option></term>
452 <para>Optional; string</para>
454 If specified, then this command will be ran after a
455 client has connected to the server (and has been
456 accepted), but before the server starts serving. If
457 the command contains the literal string '%s', then
458 this string will be replaced by the filename of the
459 file which nbd-server wants to export.
462 This is useful to create export files on the fly, or
463 to verify that a file can be used for export, to
464 write something to a log file, or similar.
467 If the command runs with a non-zero exit status,
468 then nbd-server will assume the export will fail,
469 and refuse to serve it.
474 <term><option>postrun</option></term>
476 <para>Optional; string</para>
478 If specified, then it is assumed to be a command
479 that will be ran when a client has
480 disconnected. This can be useful to clean up
481 whatever <option>prerun</option> has set up, to log
482 something, or similar.
485 If the literal string '%s' is present in the
486 command, it will be replaced by the file name that
487 has just been closed.
490 In contrast to the <option>prerun</option> option,
491 the exit state of <option>postrun</option> is
492 <emphasis>ignored</emphasis>.
500 <title>SEE ALSO</title>
502 <para>nbd-server (1), nbd-client (8),
503 http://nbd.sourceforge.net/roadmap.html</para>
507 <title>AUTHOR</title>
508 <para>The NBD kernel module and the NBD tools were originally
509 written by Pavel Machek (pavel@ucw.cz)</para>
511 <para>The Linux kernel module is now maintained by Paul Clements
512 (Paul.Clements@steeleye.com), while the userland tools are
513 maintained by &dhusername; (&dhemail;)</para>
515 <para>On The Hurd there is a regular translator available to perform the
516 client side of the protocol, and the use of
517 <command>nbd-client</command> is not required. Please see the
518 relevant documentation for more information.</para>
520 <para>This manual page was written by &dhusername; (&dhemail;) for
521 the &debian; system (but may be used by others). Permission is
522 granted to copy, distribute and/or modify this document under
523 the terms of the <acronym>GNU</acronym> General Public License,
524 version 2, as published by the Free Software Foundation.</para>
528 <title>EXAMPLES</title>
529 <para>A simple <command>nbd-server</command> configuration file
530 would look like this:</para>
534 exportname = /export/blkdev
537 <para>For increased security, one might want to create an
538 authorization file, and set the UID and GID to run as:</para>
544 exportname = /export/blkdev
546 authfile = /etc/nbd-server/allow
548 <para>With /etc/nbd-server/allow containing the following:</para>
557 <!-- Keep this comment at the end of the file
562 sgml-minimize-attributes:nil
563 sgml-always-quote-attributes:t
566 sgml-parent-document:nil
567 sgml-default-dtd-file:nil
568 sgml-exposed-tags:nil
569 sgml-local-catalogs:nil
570 sgml-local-ecat-files:nil