9ccf65f3e6ebad3c2e7d5f0489e2eca7d00dee28
[nbd.git] / nbd-client.8.in
1 .\" This manpage has been automatically generated by docbook2man 
2 .\" from a DocBook document.  This tool can be found at:
3 .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> 
4 .\" Please send any bug reports, improvements, comments, patches, 
5 .\" etc. to Steve Cheng <steve@ggi-project.org>.
6 .TH "NBD-CLIENT" "8" "01 April 2010" "" ""
7
8 .SH NAME
9 nbd-client \- connect to a server running nbd-server(1), to use its    exported block device
10 .SH SYNOPSIS
11
12 \fBnbd-client\fR [ \fBbs=\fIblocksize\fB\fR ] [ \fBtimeout=\fIseconds\fB\fR ] \fB\fIhost\fB\fR \fB\fIport\fB\fR \fB\fInbd-device\fB\fR [ \fB-sdp\fR ] [ \fB-swap\fR ] [ \fB-persist\fR ] [ \fB-nofork\fR ]
13
14
15 \fBnbd-client\fR \fB-d \fInbd-device\fB\fR
16
17
18 \fBnbd-client\fR \fB-c \fInbd-device\fB\fR
19
20 .SH "DESCRIPTION"
21 .PP
22 With \fBnbd-client\fR, you can connect to a
23 server running \fBnbd-server\fR, thus using raw
24 diskspace from that server as a blockdevice on the local
25 client.
26 .PP
27 To do this, support from the Linux Kernel is necessary, in
28 the form of the Network Block Device (NBD). When you have that,
29 either in the kernel, or as a module, you can connect to an NBD
30 server and use its exported file through a block special file with
31 major mode 43.
32 .SH "OPTIONS"
33 .PP
34 The following options are supported:
35 .TP
36 \fBbs=\fIblocksize\fB\fR
37 Use a blocksize of "blocksize". Default is 1024;
38 allowed values are either 512, 1024, 2048 or 4096
39 .TP
40 \fBhost\fR
41 The hostname or IP address of the machine running
42 \fBnbd-server\fR\&. Since 2.9.15, the NBD
43 utilities support IPv6.
44 .TP
45 \fBtimeout=\fIseconds\fB\fR
46 Set the connection timeout to "seconds". For this to
47 work, you need a kernel with support for the NBD_SET_TIMEOUT
48 ioctl; this was introduced into Linus' tree on 2007-10-11,
49 and will be part of kernel 2.6.24.
50 .TP
51 \fBport\fR
52 The TCP port on which \fBnbd-server\fR is
53 running at the server.
54 .TP
55 \fBnbd-device\fR
56 The block special file this nbd-client should connect
57 to.
58 .TP
59 \fB-c\fR
60 Check whether the specified nbd device is
61 connected.
62
63 If the device is connected, nbd-client will exit
64 with an exit state of 0 and print the PID of the nbd-client
65 instance that connected it to stdout.
66
67 If the device is not
68 connected or does not exist (for example because the nbd
69 module was not loaded), nbd-client will exit with an exit
70 state of 1 and not print anything on stdout.
71
72 If an error occurred, nbd-client will exit with an exit
73 state of 2, and not print anything on stdout either.
74 .TP
75 \fB-d\fR
76 Disconnect the specified nbd device from the
77 server
78 .TP
79 \fB-persist\fR
80 When this option is specified, nbd-client will
81 immediately try to reconnect an nbd device if the
82 connection ever drops unexpectedly due to a lost
83 server or something similar.
84 .TP
85 \fB-sdp\fR
86 Connect to the server using the Socket Direct Protocol
87 (SDP), rather than IP. See nbd-server(1) for details.
88 .TP
89 \fB-swap\fR
90 Specifies that this NBD device will be used as
91 swapspace. This option attempts to prevent deadlocks by
92 performing mlockall() at an appropriate time. It does not
93 however guarantee that such deadlocks can be avoided.
94 .TP
95 \fB-nofork\fR
96 Specifies that the NBD client should not detach and
97 daemonize itself. This is mostly useful for debugging.
98 .SH "EXAMPLES"
99 .PP
100 Some examples of nbd-client usage:
101 .TP 0.2i
102 \(bu
103 To connect to a server running on port 2000 at host
104 "server.domain.com", using the client's block special file
105 "/dev/nb0":
106
107 \fBnbd-client server.domain.com 2000
108 /dev/nb0\fR
109 .TP 0.2i
110 \(bu
111 To connect to a server running on port 2001 at host
112 "swapserver.domain.com", using the client's block special
113 file "/dev/nb1", for swap purposes:
114
115 \fBnbd-client swapserver.domain.com 2001 /dev/nb1
116 -swap\fR
117 .TP 0.2i
118 \(bu
119 To disconnect the above connection again (after making
120 sure the block special file is not in use anymore):
121
122 \fBnbd-client -d /dev/nb1\fR
123 .SH "SEE ALSO"
124 .PP
125 nbd-server (1).
126 .SH "AUTHOR"
127 .PP
128 The NBD kernel module and the NBD tools have been written by
129 Pavel Macheck (pavel@ucw.cz).
130 .PP
131 The kernel module is now maintained by Paul Clements
132 (Paul.Clements@steeleye.com), while the userland tools are maintained by
133 Wouter Verhelst (wouter@debian.org)
134 .PP
135 This manual page was written by Wouter Verhelst (<wouter@debian.org>) for
136 the Debian GNU/Linux system (but may be used by others).  Permission is
137 granted to copy, distribute and/or modify this document under the
138 terms of the GNU General Public License,
139 version 2, as published by the Free Software Foundation.