1NBD-SERVER(1)                                                    NBD-SERVER(1)
2
3
4

NAME

6       nbd-server  - serve a file as a block device to other computers    run‐
7       ning the GNU/Linux(tm) or GNU/Hurd Operating    System
8

SYNOPSIS

10       nbd-server  [ip@]port filename [ size ] [ -r ] [ -m ] [ -c ] [ -l  host
11       list filename ] [ -o section name ] [ -C config file ] [ -M max connec‐
12       tions ]
13
14

DESCRIPTION

16       nbd-server is the server for the Linux Network Block Device (NBD). With
17       NBD,  a client can use a file, exported over the network from a server,
18       as a block device. It can then be used for whatever  purpose  a  normal
19       block device (harddisk, CD-ROM, ...) can be used for.
20
21       NBD can be useful for diskless clients that need swapspace, but you can
22       also create a filesystem on it and use it as though  it  were  a  local
23       filesystem.
24
25       nbd-server  implements  some  security through a file called "/etc/nbd-
26       server/allow" (by default; a different file can be chosen with the '-l'
27       option or through a config file specification). This file must list the
28       IP-addresses or network masks of clients that are allowed  to  connect.
29       If  it  does not exist, all clients are able to connect. If the file is
30       empty, no clients can connect.
31
32       Note that while the command line allows for specifying an  export,  the
33       use of this option is deprecated. It is preferred to make use of a con‐
34       figuration file instead,  the  format  of  which  is  defined  in  nbd-
35       server(5).
36

OPTIONS

38       ip     The  ip address the server should listen on. This may be an IPv4
39              address, an IPv6 address, or a hostname.  In  the  latter  case,
40              nbd-server will do a hostname lookup for the name specified, and
41              will listen on the first address that is returned. For  compati‐
42              bility  with  past versions of nbd-server, if an IPv4 address is
43              specified, the @ sign  that  serves  as  separator  between  the
44              address and port may be replaced by a colon.
45
46              If  this  parameter  is not specified, nbd-server will listen on
47              all local addresses on both IPv4 and IPv6.  To  limit  to  IPv4,
48              specify  the address as 0.0.0.0; to limit to IPv6, specify it as
49              ::.
50
51       port   The port the server should listen to. A valid port is any number
52              between  1  and  65536;  if 0 is used, nbd-server will listen on
53              stdin (so that nbd-server can be ran from inetd)
54
55       filename
56              The filename of the file that should be exported.  This  can  be
57              any file, including "real" blockdevices (i.e. a file from /dev).
58              If the filename includes the literal string "%s", then  this  %s
59              will  be substituded with the IP-address of the client trying to
60              connect.
61
62       size   The size of the block device at the client side. This  is  espe‐
63              cially useful in conjunction with the -m option
64
65              Can  optionally  be followed by one of K,k,M or m, in which case
66              the size will be multiplied by 1024 (K or k) or 1048576 (M or m)
67
68       -r     Export the file read-only. If a client tries to write to a read-
69              only exported file, it will receive an error, but the connection
70              will stay up.
71
72       -m     Work with multiple files. This can be used  to  export  blockde‐
73              vices  that  are  larger  than the maximum allowed filesize on a
74              given filesystem; i.e. when the filesystem does not allow  files
75              larger than 2GB (which is true for Linux 2.2 and below), you can
76              use this option to store the data in multiple files and export a
77              larger filesystem, if needed.
78
79              To use this option, you must create a number of files with names
80              in the format "name.X", where "name" is given  as  the  filename
81              argument  to  nbd-server,  and "X" is a number starting by 0 and
82              going up for each file.
83
84              Allowing more flexibility for this option is planned for  future
85              versions.
86
87       -c     Copy  on  write.  When this option is provided, write-operations
88              are not done to the exported file, but to a separate file.  This
89              separate  file  is  removed when the connection is closed, which
90              means that serving this  way  will  make  nbd-server  slow  down
91              (especially  on  large  block  devices with lots of writes), and
92              that after disconnecting and  reconnecting  the  client  or  the
93              server, all changes are lost.
94
95       -C     Specify  configuration  file. The default configuration file, if
96              this parameter is not specified, is /etc/nbd-server/config.
97
98              Note that the  configuration  file  is  always  parsed  and  the
99              entries  in  the file used, even if an extra server is specified
100              on the command line. To disable the configuration file entirely,
101              either  move it away or use the -C option to point nbd-server(1)
102              to a non-existing or empty configuration file.
103
104              Also note that if an empty, incomplete, or invalid configuration
105              file is specified, nbd-server will produce a warning about fail‐
106              ure to parse the config file. If the  command  line  contains  a
107              fully  specified configuration, this warning is harmless and may
108              be ignored.
109
110       -M     Specify the maximum number of opened connections. If this param‐
111              eter is not specified, no limit is set.
112
113       host list filename
114              This  argument  should  contain a list of IP-addresses for hosts
115              that may connect to the server. Wildcards are  not  allowed.  If
116              the  file  does  not exist, it is ignored (and any host can con‐
117              nect); If the file does exist, but is empty, no  host  can  con‐
118              nect.  By  default,  the  name  'nbd_server.allow'  is used, and
119              looked for in the current directory, unless nbd-server  is  com‐
120              piled  as  a daemon, in which case it is looked for in the root-
121              directory.
122
123       section name
124              If the -o argument is given on the command line, then nbd-server
125              will output a configuration file section with this as the header
126              that is functionally equivalent to the other  options  specified
127              on  the  command  line,  and  exit. This is useful for migrating
128              pre-2.9 nbd-server initscript configuration  files  to  the  new
129              format.
130

EXAMPLES

132       Some examples of nbd-server usage:
133
134       · To export a file /export/nbd/exp-bl-dev on port 2000:
135
136         nbd-server 2000 /export/nbd/exp-bl-dev
137
138       · To export a the same file read-only:
139
140         nbd-server 2000 /export/nbd/exp-bl-dev -r
141
142       · To  export  the  same file read-write, but make sure changes are lost
143         after restarting the client or the server:
144
145         nbd-server 2000 /export/nbd/exp-bl-dev -c
146

SEE ALSO

148       nbd-client (8), nbd-server (5)
149

AUTHOR

151       The NBD kernel module and the NBD  tools  were  originally  written  by
152       Pavel Machek (pavel@ucw.cz)
153
154       The   Linux   kernel   module   is  now  maintained  by  Paul  Clements
155       (Paul.Clements@steeleye.com), while the userland tools  are  maintained
156       by Wouter Verhelst (<wouter@debian.org>)
157
158       On  The  Hurd  there  is  a regular translator available to perform the
159       client side of the protocol, and the use of nbd-client is not required.
160       Please see the relevant documentation for more information.
161
162       This  manual  page was written by Wouter Verhelst (<wouter@debian.org>)
163       for the Debian GNU/Linux system (but may be used by  others).   Permis‐
164       sion  is  granted to copy, distribute and/or modify this document under
165       the terms of the GNU General Public License, version 2, as published by
166       the Free Software Foundation.
167
168
169
170                                27 January 2011                  NBD-SERVER(1)
Impressum