Revisit documentation
[nbd.git] / nbd-server.1.sgml
1 <!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
2
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:
7
8 manpage.1: manpage.sgml
9         docbook-to-man $< > $@
10   -->
11
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$</date>">
17   <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
18        allowed: see man(7), man(1). -->
19   <!ENTITY dhsection   "<manvolnum>1</manvolnum>">
20   <!ENTITY dhemail     "<email>wouter@debian.org</email>">
21   <!ENTITY dhusername  "Wouter Verhelst">
22   <!ENTITY dhucpackage "<refentrytitle>NBD-SERVER</refentrytitle>">
23   <!ENTITY dhpackage   "nbd-server">
24
25   <!ENTITY debian      "<productname>Debian GNU/Linux</productname>">
26   <!ENTITY gnu         "<acronym>GNU</acronym>">
27 ]>
28
29 <refentry>
30   <refentryinfo>
31     <address>
32       &dhemail;
33     </address>
34     <author>
35       &dhfirstname;
36       &dhsurname;
37     </author>
38     <copyright>
39       <year>2001</year>
40       <holder>&dhusername;</holder>
41     </copyright>
42     &dhdate;
43   </refentryinfo>
44   <refmeta>
45     &dhucpackage;
46
47     &dhsection;
48   </refmeta>
49   <refnamediv>
50     <refname>&dhpackage;</refname>
51
52     <refpurpose>serve a file as a block device to other computers
53     running the &gnu;/Linux(tm) or &gnu;/Hurd Operating
54     System</refpurpose>
55   </refnamediv>
56   <refsynopsisdiv>
57     <cmdsynopsis>
58       <command>&dhpackage; </command>
59
60       <arg choice=plain><replaceable>[ip@]port</replaceable</arg>
61       <arg choice=plain><replaceable>filename</replaceable></arg>
62       <arg><replaceable>size</replaceable></arg>
63       <arg><option>-r</option></arg>
64       <arg><option>-m</option></arg>
65       <arg><option>-c</option></arg>
66       <arg><option>-l <replaceable>host list filename</replaceable></option></arg>
67       <arg><option>-o <replaceable>section name</replaceable></option></arg>
68       <arg><option>-C <replaceable>config file</replaceable></option></arg>
69     </cmdsynopsis>
70   </refsynopsisdiv>
71   <refsect1>
72     <title>DESCRIPTION</title>
73
74     <para><command>&dhpackage;</command> is the server for the Linux
75     Network Block Device (NBD). With NBD, a client can use a file,
76     exported over the network from a server, as a block device. It can
77     then be used for whatever purpose a normal block device (harddisk,
78     CD-ROM, ...) can be used for.</para>
79
80     <para>NBD can be useful for diskless clients that need swapspace,
81     but you can also create a filesystem on it and use it as though it
82     were a local filesystem.</para>
83
84     <para><command>&dhpackage;</command> implements some security
85     through a file called "@sysconfdir@/nbd-server/allow" (by default; a
86     different file can be chosen with the '-l' option or through a
87     config file specification). This file must list the IP-addresses or
88     network masks of clients that are allowed to connect. If it does not
89     exist, all clients are able to connect. If the file is empty, no
90     clients can connect.</para>
91
92     <para>Note that while the command line allows for specifying an
93     export, the use of this option is deprecated. It is preferred to
94     make use of a configuration file instead, the format of which is
95     defined in nbd-server(5).</para>
96   </refsect1>
97   <refsect1>
98     <title>OPTIONS</title>
99     
100     <variablelist>
101       <varlistentry>
102         <term>ip</term>
103         <listitem>
104           <para>The ip address the server should listen on. This may
105           be an IPv4 address, an IPv6 address, or a hostname. In the
106           latter case, nbd-server will do a hostname lookup for the
107           name specified, and will listen on the first address that is
108           returned. For compatibility with past versions of
109           nbd-server, if an IPv4 address is specified, the @ sign that
110           serves as separator between the address and port may be
111           replaced by a colon.</para>
112           <para>If this parameter is not specified, nbd-server will
113           listen on all local addresses on both IPv4 and IPv6. To
114           limit to IPv4, specify the address as 0.0.0.0; to limit to
115           IPv6, specify it as ::.</para>
116         </listitem>
117       </varlistentry>
118       <varlistentry>
119         <term><option>port</option>
120         </term>
121         <listitem>
122           <para>The port the server should listen to. A valid port is
123             any number between 1 and 65536; if 0 is used, nbd-server
124             will listen on stdin (so that nbd-server can be ran from
125             inetd)</para>
126         </listitem>
127       </varlistentry>
128       <varlistentry>
129         <term><option>filename</option></term>
130         <listitem>
131           <para>The filename of the file that should be exported. This
132           can be any file, including "real" blockdevices (i.e. a file
133           from /dev). If the filename includes the literal string
134           "%s", then this %s will be substituded with the IP-address
135           of the client trying to connect.</para>
136         </listitem>
137       </varlistentry>
138       <varlistentry>
139         <term><option>size</option></term>
140         <listitem>
141           <para>The size of the block device at the client side. This
142             is especially useful in conjunction with the -m
143             option</para>
144           <para>Can optionally be followed by one of K,k,M or
145             m, in which case the size will be multiplied by 1024 (K
146             or k) or 1048576 (M or m)</para>
147         </listitem>
148       </varlistentry>
149       <varlistentry>
150         <term><option>-r</option></term>
151         <listitem>
152           <para>Export the file read-only. If a client tries to write
153             to a read-only exported file, it will receive an error, but
154             the connection will stay up.</para>
155         </listitem>
156       </varlistentry>
157       <varlistentry>
158         <term><option>-m</option></term>
159         <listitem>
160           <para>Work with multiple files. This can be used to export
161             blockdevices that are larger than the maximum allowed
162             filesize on a given filesystem; i.e. when the filesystem
163             does not allow files larger than 2GB (which is true for
164             Linux 2.2 and below), you can use this option to store the
165             data in multiple files and export a larger filesystem, if
166             needed.</para>
167           <para>
168             To use this option, you must create a number of files
169             with names in the format "name.X", where "name" is given as
170             the filename argument to nbd-server, and "X" is a number
171             starting by 0 and going up for each file.
172           </para>
173           <para>
174             Allowing more flexibility for this option is planned for
175             future versions.</para>
176         </listitem>
177       </varlistentry>
178       <varlistentry>
179         <term><option>-c</option></term>
180         <listitem>
181           <para>Copy on write. When this option is provided,
182             write-operations are not done to the exported file, but to a
183             separate file. This separate file is removed when the
184             connection is closed, which means that serving this way will
185             make nbd-server slow down (especially on large block devices
186             with lots of writes), and that after disconnecting and
187             reconnecting the client or the server, all changes are
188             lost.</para>
189         </listitem>
190       </varlistentry>
191       <varlistentry>
192         <term><option>-C</option></term>
193         <listitem>
194           <para>Specify configuration file. The default configuration
195             file, if this parameter is not specified, is
196             <filename>@sysconfdir@/nbd-server/config</filename>.</para>
197           <para>Note that the configuration file is always parsed and
198             the entries in the file used, even if an extra server is
199             specified on the command line. To disable the configuration
200             file entirely, either move it away or use the -C option to
201             point <command>nbd-server</command>(1) to a non-existing or
202             empty configuration file.</para>
203           <para>Also note that if an empty, incomplete, or invalid
204             configuration file is specified, nbd-server will produce a
205             warning about failure to parse the config file. If the
206             command line contains a fully specified configuration, this
207             warning is harmless and may be ignored.</para>
208         </listitem>
209       </varlistentry>
210       <varlistentry>
211         <term><option>host list filename</option></term>
212         <listitem>
213           <para>This argument should contain a list of IP-addresses
214             for hosts that may connect to the server. Wildcards are
215             <emphasis>not</emphasis> allowed. If the file does not
216             exist, it is ignored (and any host can connect); If the file
217             does exist, but is empty, no host can connect. By default,
218             the name 'nbd_server.allow' is used, and looked for in the
219             current directory, unless nbd-server is compiled as a
220             daemon, in which case it is looked for in the
221             root-directory.</para>
222         </listitem>
223       </varlistentry>
224       <varlistentry>
225         <term><option>section name</option></term>
226         <listitem>
227           <para>If the <option>-o</option> argument is given on the
228           command line, then &dhpackage; will output a configuration
229           file section with this as the header that is functionally
230           equivalent to the other options specified on the command line,
231           and exit. This is useful for migrating pre-2.9 nbd-server
232           initscript configuration files to the new format.</para>
233         </listitem>
234       </varlistentry>
235     </variablelist>
236     
237   </refsect1>
238   <refsect1>
239     <title>EXAMPLES</title>
240     <para>Some examples of nbd-server usage:</para>
241     <itemizedlist mark="none">
242       <listitem>
243         <para>To export a file /export/nbd/exp-bl-dev on port 2000:</para>
244         <para><command>nbd-server 2000 /export/nbd/exp-bl-dev</command></para>
245       </listitem>
246       <listitem>
247         <para>To export a the same file read-only:</para>
248         <para><command>nbd-server 2000 /export/nbd/exp-bl-dev -r</command></para>
249       </listitem>
250       <listitem>
251         <para>To export the same file read-write, but make sure
252           changes are lost after restarting the client or the
253           server:</para>
254         <para><command>nbd-server 2000 /export/nbd/exp-bl-dev
255             -c</command></para>
256       </listitem>
257     </itemizedlist>
258   </refsect1>
259   <refsect1>
260     <title>SEE ALSO</title>
261     
262     <para>nbd-client (8), nbd-server (5), http://nbd.sourceforge.net/roadmap.html</para>
263     
264   </refsect1>
265   <refsect1>
266     <title>AUTHOR</title>
267     <para>The NBD kernel module and the NBD tools were originally
268       written by Pavel Machek (pavel@ucw.cz)</para>
269     
270     <para>The Linux kernel module is now maintained by Paul Clements
271       (Paul.Clements@steeleye.com), while the userland tools are
272       maintained by &dhusername; (&dhemail;)</para>
273
274     <para>On The Hurd there is a regular translator available to perform the
275       client side of the protocol, and the use of
276       <command>nbd-client</command> is not required. Please see the
277       relevant documentation for more information.</para>
278
279     <para>This manual page was written by &dhusername; (&dhemail;) for
280       the &debian; system (but may be used by others).  Permission is
281       granted to copy, distribute and/or modify this document under
282       the terms of the <acronym>GNU</acronym> General Public License,
283       version 2, as published by the Free Software Foundation.</para>
284
285   </refsect1>
286 </refentry>