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