xref: /freebsd-13-stable/usr.bin/iscsictl/iscsictl.8 (revision b144e70a3325e033163aa4e6e15d0446e245702d)
1.\" Copyright (c) 2012 The FreeBSD Foundation
2.\"
3.\" This software was developed by Edward Tomasz Napierala under sponsorship
4.\" from the FreeBSD Foundation.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd December 27, 2018
28.Dt ISCSICTL 8
29.Os
30.Sh NAME
31.Nm iscsictl
32.Nd iSCSI initiator management utility
33.Sh SYNOPSIS
34.Nm
35.Fl A
36.Fl p Ar portal Fl t Ar target
37.Op Fl u Ar user Fl s Ar secret
38.Op Fl w Ar timeout
39.Op Fl r
40.Op Fl e Cm on Ns | Ns Cm off
41.Nm
42.Fl A
43.Fl d Ar discovery-host
44.Op Fl u Ar user Fl s Ar secret
45.Op Fl r
46.Op Fl e Cm on Ns | Ns Cm off
47.Nm
48.Fl A
49.Fl a Op Fl c Ar path
50.Nm
51.Fl A
52.Fl n Ar nickname Op Fl c Ar path
53.Nm
54.Fl M
55.Fl i Ar session-id
56.Op Fl p Ar portal
57.Op Fl t Ar target
58.Op Fl u Ar user
59.Op Fl s Ar secret
60.Op Fl e Cm on Ns | Ns Cm off
61.Nm
62.Fl M
63.Fl i Ar session-id
64.Op Fl n Ar nickname Op Fl c Ar path
65.Nm
66.Fl R
67.Op Fl p Ar portal
68.Op Fl t Ar target
69.Nm
70.Fl R
71.Fl a
72.Nm
73.Fl R
74.Fl n Ar nickname Op Fl c Ar path
75.Nm
76.Fl L
77.Op Fl v
78.Op Fl w Ar timeout
79.Sh DESCRIPTION
80The
81.Nm
82utility is used to configure the iSCSI initiator.
83.Pp
84The following options are available:
85.Bl -tag -width "-d discovery-host"
86.It Fl -libxo
87Generate output via
88.Xr libxo 3
89in a selection of different human and machine readable formats.
90See
91.Xr xo_parse_args 3
92for details on command line arguments.
93.It Fl A
94Add session.
95.It Fl M
96Modify session.
97.It Fl R
98Remove session.
99.It Fl L
100List sessions.
101.It Fl a
102When adding, add all sessions defined in the configuration file.
103When removing, remove all currently established sessions.
104.It Fl c Ar path
105Path to the configuration file.
106The default is
107.Pa /etc/iscsi.conf .
108.It Fl d Ar discovery-host
109Target host name or address used for SendTargets discovery.
110When used, it will add a temporary discovery session.
111After discovery is done, sessions will be added for each discovered target,
112and the temporary discovery session will be removed.
113.It Fl e Cm on Ns | Ns Cm off
114Enable or disable the session.
115This is ignored for discovery sessions, but gets passed down to normal
116sessions they add.
117.It Fl i Ar session-id
118Session ID, as displayed by
119.Nm
120.Fl v .
121.It Fl n Ar nickname
122The
123.Ar nickname
124of a session defined in the configuration file.
125.It Fl p Ar portal
126Target portal \(em host name or address \(em for statically defined targets.
127.It Fl r
128Use iSER (iSCSI over RDMA) instead of plain iSCSI over TCP/IP.
129.It Fl s Ar secret
130CHAP secret.
131.It Fl t Ar target
132Target name.
133.It Fl u Ar user
134CHAP login.
135.It Fl v
136Verbose mode.
137.It Fl w Ar timeout
138Instead of returning immediately, wait up to
139.Ar timeout
140seconds until all configured sessions are successfully established.
141.El
142.Pp
143Certain parameters are necessary when adding a session.
144One can specify these either via command line (using the
145.Fl t ,
146.Fl p ,
147.Fl u ,
148and
149.Fl s
150options), or configuration file (using the
151.Fl a
152or
153.Fl n
154options).
155Some functionality - for example mutual CHAP - is available only
156via configuration file.
157.Pp
158Since connecting to the target is performed in background, non-zero
159exit status does not mean that the session was successfully established.
160Use either
161.Nm Fl L
162to check the connection status, or the
163.Fl w
164flag to wait for session establishment.
165.Pp
166Note that in order for the iSCSI initiator to be able to connect to a target,
167the
168.Xr iscsid 8
169daemon must be running.
170.Pp
171Also note that
172.Fx
173currently supports two different initiators: the old one,
174.Xr iscsi_initiator 4 ,
175with its control utility
176.Xr iscontrol 8 ,
177and the new one,
178.Xr iscsi 4 ,
179with
180.Nm
181and
182.Xr iscsid 8 .
183The only thing the two have in common is the configuration file,
184.Xr iscsi.conf 5 .
185.Sh FILES
186.Bl -tag -width ".Pa /etc/iscsi.conf" -compact
187.It Pa /etc/iscsi.conf
188iSCSI initiator configuration file.
189.El
190.Sh EXIT STATUS
191The
192.Nm
193utility exits 0 on success, and >0 if an error occurs.
194.Sh EXAMPLES
195Attach to target iqn.2012-06.com.example:target0, served by 192.168.1.1:
196.Dl Nm Fl A Fl t Ar iqn.2012-06.com.example:target0 Fl p Ar 192.168.1.1
197.Pp
198Perform discovery on 192.168.1.1, and add disabled sessions for each
199discovered target; use
200.Nm -M -e on
201to connect them:
202.Dl Nm Fl A Fl d Ar 192.168.1.1 Fl e Ar off
203.Pp
204Disconnect all iSCSI sessions:
205.Dl Nm Fl Ra
206.Sh SEE ALSO
207.Xr libxo 3 ,
208.Xr xo_parse_args 3 ,
209.Xr iscsi 4 ,
210.Xr iscsi.conf 5 ,
211.Xr iscsid 8
212.Sh HISTORY
213The
214.Nm
215command appeared in
216.Fx 10.0 .
217.Sh AUTHORS
218The
219.Nm
220utility was developed by
221.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
222under sponsorship from the FreeBSD Foundation.
223