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